1983 lines
116 KiB
Java
Executable file
1983 lines
116 KiB
Java
Executable file
package game.worldgen.structure;
|
|
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
|
|
import game.biome.Biome;
|
|
import game.block.Block;
|
|
import game.block.BlockLog;
|
|
import game.block.BlockSandStone;
|
|
import game.block.BlockSlab;
|
|
import game.block.BlockStairs;
|
|
import game.block.BlockTorch;
|
|
import game.collect.Lists;
|
|
import game.color.DyeColor;
|
|
import game.entity.npc.EntityHuman;
|
|
import game.init.BlockRegistry;
|
|
import game.init.Blocks;
|
|
import game.init.Config;
|
|
import game.material.Material;
|
|
import game.nbt.NBTTagCompound;
|
|
import game.rng.Random;
|
|
import game.world.BlockPos;
|
|
import game.world.Facing;
|
|
import game.world.State;
|
|
import game.world.WorldServer;
|
|
import game.worldgen.BiomeGenerator;
|
|
import game.worldgen.LootConstants;
|
|
|
|
|
|
public class StructureVillage
|
|
{
|
|
public static void registerVillagePieces()
|
|
{
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.House1.class, "ViBH");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.Field1.class, "ViDF");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.Field2.class, "ViF");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.Torch.class, "ViL");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.Hall.class, "ViPH");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.House4Garden.class, "ViSH");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.WoodHut.class, "ViSmH");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.Church.class, "ViST");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.House2.class, "ViS");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.Start.class, "ViStart");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.Path.class, "ViSR");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.House3.class, "ViTRH");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.Well.class, "ViW");
|
|
MapGenStructureIO.registerStructureComponent(StructureVillage.Cage.class, "ViC");
|
|
}
|
|
|
|
public static List<StructureVillage.PieceWeight> getStructureVillageWeightedPieceList(Random random, int size)
|
|
{
|
|
List<StructureVillage.PieceWeight> list = Lists.<StructureVillage.PieceWeight>newArrayList();
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.House4Garden.class, 4, random.rangeChecked(2 + size, 4 + size * 2)));
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.Church.class, 20, random.rangeChecked(0 + size, 1 + size)));
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.House1.class, 20, random.rangeChecked(0 + size, 2 + size)));
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.WoodHut.class, 3, random.rangeChecked(2 + size, 5 + size * 3)));
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.Hall.class, 15, random.rangeChecked(0 + size, 2 + size)));
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.Field1.class, 3, random.rangeChecked(1 + size, 4 + size)));
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.Field2.class, 3, random.rangeChecked(2 + size, 4 + size * 2)));
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.House2.class, 15, random.rangeChecked(0, 1 + size)));
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.House3.class, 8, random.rangeChecked(0 + size, 3 + size * 2)));
|
|
list.add(new StructureVillage.PieceWeight(StructureVillage.Cage.class, 20, random.rangeChecked(0 + size, 2 + size)));
|
|
Iterator<StructureVillage.PieceWeight> iterator = list.iterator();
|
|
|
|
while (iterator.hasNext())
|
|
{
|
|
if (((StructureVillage.PieceWeight)iterator.next()).villagePiecesLimit == 0)
|
|
{
|
|
iterator.remove();
|
|
}
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
private static int func_75079_a(List<StructureVillage.PieceWeight> p_75079_0_)
|
|
{
|
|
boolean flag = false;
|
|
int i = 0;
|
|
|
|
for (StructureVillage.PieceWeight structurevillagepieces$pieceweight : p_75079_0_)
|
|
{
|
|
if (structurevillagepieces$pieceweight.villagePiecesLimit > 0 && structurevillagepieces$pieceweight.villagePiecesSpawned < structurevillagepieces$pieceweight.villagePiecesLimit)
|
|
{
|
|
flag = true;
|
|
}
|
|
|
|
i += structurevillagepieces$pieceweight.villagePieceWeight;
|
|
}
|
|
|
|
return flag ? i : -1;
|
|
}
|
|
|
|
private static StructureVillage.Village func_176065_a(StructureVillage.Start start, StructureVillage.PieceWeight weight, List<StructureComponent> p_176065_2_, Random rand, int p_176065_4_, int p_176065_5_, int p_176065_6_, Facing facing, int p_176065_8_)
|
|
{
|
|
Class <? extends StructureVillage.Village > oclass = weight.villagePieceClass;
|
|
StructureVillage.Village structurevillagepieces$village = null;
|
|
|
|
if (oclass == StructureVillage.House4Garden.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.House4Garden.func_175858_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
else if (oclass == StructureVillage.Church.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.Church.func_175854_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
else if (oclass == StructureVillage.House1.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.House1.func_175850_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
else if (oclass == StructureVillage.WoodHut.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.WoodHut.func_175853_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
else if (oclass == StructureVillage.Hall.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.Hall.func_175857_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
else if (oclass == StructureVillage.Field1.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.Field1.func_175851_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
else if (oclass == StructureVillage.Field2.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.Field2.func_175852_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
else if (oclass == StructureVillage.House2.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.House2.func_175855_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
else if (oclass == StructureVillage.House3.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.House3.func_175849_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
else if (oclass == StructureVillage.Cage.class)
|
|
{
|
|
structurevillagepieces$village = StructureVillage.Cage.func_175853_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
|
}
|
|
|
|
return structurevillagepieces$village;
|
|
}
|
|
|
|
private static StructureVillage.Village func_176067_c(StructureVillage.Start start, List<StructureComponent> p_176067_1_, Random rand, int p_176067_3_, int p_176067_4_, int p_176067_5_, Facing facing, int p_176067_7_)
|
|
{
|
|
int i = func_75079_a(start.structureVillageWeightedPieceList);
|
|
|
|
if (i <= 0)
|
|
{
|
|
return null;
|
|
}
|
|
else
|
|
{
|
|
int j = 0;
|
|
|
|
while (j < 5)
|
|
{
|
|
++j;
|
|
int k = rand.zrange(i);
|
|
|
|
for (StructureVillage.PieceWeight structurevillagepieces$pieceweight : start.structureVillageWeightedPieceList)
|
|
{
|
|
k -= structurevillagepieces$pieceweight.villagePieceWeight;
|
|
|
|
if (k < 0)
|
|
{
|
|
if (!structurevillagepieces$pieceweight.canSpawnMoreVillagePiecesOfType(p_176067_7_) || structurevillagepieces$pieceweight == start.structVillagePieceWeight && start.structureVillageWeightedPieceList.size() > 1)
|
|
{
|
|
break;
|
|
}
|
|
|
|
StructureVillage.Village structurevillagepieces$village = func_176065_a(start, structurevillagepieces$pieceweight, p_176067_1_, rand, p_176067_3_, p_176067_4_, p_176067_5_, facing, p_176067_7_);
|
|
|
|
if (structurevillagepieces$village != null)
|
|
{
|
|
++structurevillagepieces$pieceweight.villagePiecesSpawned;
|
|
start.structVillagePieceWeight = structurevillagepieces$pieceweight;
|
|
|
|
if (!structurevillagepieces$pieceweight.canSpawnMoreVillagePieces())
|
|
{
|
|
start.structureVillageWeightedPieceList.remove(structurevillagepieces$pieceweight);
|
|
}
|
|
|
|
return structurevillagepieces$village;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
StructureBoundingBox structureboundingbox = StructureVillage.Torch.func_175856_a(start, p_176067_1_, rand, p_176067_3_, p_176067_4_, p_176067_5_, facing);
|
|
|
|
if (structureboundingbox != null)
|
|
{
|
|
return new StructureVillage.Torch(start, p_176067_7_, rand, structureboundingbox, facing);
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
private static StructureComponent func_176066_d(StructureVillage.Start start, List<StructureComponent> p_176066_1_, Random rand, int p_176066_3_, int p_176066_4_, int p_176066_5_, Facing facing, int p_176066_7_)
|
|
{
|
|
if (p_176066_7_ > 50)
|
|
{
|
|
return null;
|
|
}
|
|
else if (Math.abs(p_176066_3_ - start.getBoundingBox().minX) <= 112 && Math.abs(p_176066_5_ - start.getBoundingBox().minZ) <= 112)
|
|
{
|
|
StructureComponent structurecomponent = func_176067_c(start, p_176066_1_, rand, p_176066_3_, p_176066_4_, p_176066_5_, facing, p_176066_7_ + 1);
|
|
|
|
if (structurecomponent != null)
|
|
{
|
|
int i = (structurecomponent.boundingBox.minX + structurecomponent.boundingBox.maxX) / 2;
|
|
int j = (structurecomponent.boundingBox.minZ + structurecomponent.boundingBox.maxZ) / 2;
|
|
int k = structurecomponent.boundingBox.maxX - structurecomponent.boundingBox.minX;
|
|
int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ;
|
|
int i1 = k > l ? k : l;
|
|
|
|
if (start.getBiomeGenerator().areBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.villageSpawnBiomes))
|
|
{
|
|
p_176066_1_.add(structurecomponent);
|
|
start.field_74932_i.add(structurecomponent);
|
|
return structurecomponent;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private static StructureComponent func_176069_e(StructureVillage.Start start, List<StructureComponent> p_176069_1_, Random rand, int p_176069_3_, int p_176069_4_, int p_176069_5_, Facing facing, int p_176069_7_)
|
|
{
|
|
if (p_176069_7_ > 3 + start.terrainType)
|
|
{
|
|
return null;
|
|
}
|
|
else if (Math.abs(p_176069_3_ - start.getBoundingBox().minX) <= 112 && Math.abs(p_176069_5_ - start.getBoundingBox().minZ) <= 112)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureVillage.Path.func_175848_a(start, p_176069_1_, rand, p_176069_3_, p_176069_4_, p_176069_5_, facing);
|
|
|
|
if (structureboundingbox != null && structureboundingbox.minY > 10)
|
|
{
|
|
StructureComponent structurecomponent = new StructureVillage.Path(start, p_176069_7_, rand, structureboundingbox, facing);
|
|
int i = (structurecomponent.boundingBox.minX + structurecomponent.boundingBox.maxX) / 2;
|
|
int j = (structurecomponent.boundingBox.minZ + structurecomponent.boundingBox.maxZ) / 2;
|
|
int k = structurecomponent.boundingBox.maxX - structurecomponent.boundingBox.minX;
|
|
int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ;
|
|
int i1 = k > l ? k : l;
|
|
|
|
if (start.getBiomeGenerator().areBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.villageSpawnBiomes))
|
|
{
|
|
p_176069_1_.add(structurecomponent);
|
|
start.field_74930_j.add(structurecomponent);
|
|
return structurecomponent;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static class Church extends StructureVillage.Village
|
|
{
|
|
public Church()
|
|
{
|
|
}
|
|
|
|
public Church(StructureVillage.Start start, int p_i45564_2_, Random rand, StructureBoundingBox p_i45564_4_, Facing facing)
|
|
{
|
|
super(start, p_i45564_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45564_4_;
|
|
}
|
|
|
|
public static StructureVillage.Church func_175854_a(StructureVillage.Start start, List<StructureComponent> p_175854_1_, Random rand, int p_175854_3_, int p_175854_4_, int p_175854_5_, Facing facing, int p_175854_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175854_3_, p_175854_4_, p_175854_5_, 0, 0, 0, 5, 12, 9, facing);
|
|
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175854_1_, structureboundingbox) == null ? new StructureVillage.Church(start, p_175854_7_, rand, structureboundingbox, facing) : null;
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 12 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 3, 7, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 3, 9, 3, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 3, 0, 8, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 3, 10, 0, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 10, 3, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 10, 3, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 4, 0, 4, 7, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 4, 4, 4, 7, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 8, 3, 4, 8, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 4, 3, 10, 4, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 5, 3, 5, 7, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 9, 0, 4, 9, 4, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 4, 4, 4, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 0, 11, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 4, 11, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 2, 11, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 2, 11, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 1, 1, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 1, 1, 7, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 2, 1, 7, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 3, 1, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 3, 1, 7, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), 1, 1, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), 2, 1, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), 3, 1, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 1)), 1, 2, 7, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 0)), 3, 2, 7, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 3, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 4, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 4, 3, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 6, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 7, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 4, 6, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 4, 7, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 6, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 7, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 6, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 7, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 3, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 4, 3, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 3, 8, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 2, 4, 7, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), 1, 4, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), 3, 4, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 4, 5, structureBoundingBoxIn);
|
|
int i = this.getMetadataWithOffset(Blocks.ladder, 4);
|
|
|
|
for (int j = 1; j <= 9; ++j)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, j, 3, structureBoundingBoxIn);
|
|
}
|
|
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 2, 1, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 2, 2, 0, structureBoundingBoxIn);
|
|
this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 2, 1, 0, Facing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
|
|
|
if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn);
|
|
}
|
|
|
|
for (int l = 0; l < 9; ++l)
|
|
{
|
|
for (int k = 0; k < 5; ++k)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, k, 12, l, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getState(), k, -1, l, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.spawnVillagers(worldIn, structureBoundingBoxIn, 2, 1, 2, 1);
|
|
return true;
|
|
}
|
|
|
|
// protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
|
// {
|
|
// return 2;
|
|
// }
|
|
}
|
|
|
|
public static class Field1 extends StructureVillage.Village
|
|
{
|
|
private Block cropTypeA;
|
|
private Block cropTypeB;
|
|
private Block cropTypeC;
|
|
private Block cropTypeD;
|
|
|
|
public Field1()
|
|
{
|
|
}
|
|
|
|
public Field1(StructureVillage.Start start, int p_i45570_2_, Random rand, StructureBoundingBox p_i45570_4_, Facing facing)
|
|
{
|
|
super(start, p_i45570_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45570_4_;
|
|
this.cropTypeA = this.func_151559_a(rand);
|
|
this.cropTypeB = this.func_151559_a(rand);
|
|
this.cropTypeC = this.func_151559_a(rand);
|
|
this.cropTypeD = this.func_151559_a(rand);
|
|
}
|
|
|
|
protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.writeStructureToNBT(tagCompound);
|
|
tagCompound.setInteger("CA", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeA));
|
|
tagCompound.setInteger("CB", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeB));
|
|
tagCompound.setInteger("CC", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeC));
|
|
tagCompound.setInteger("CD", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeD));
|
|
}
|
|
|
|
protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.readStructureFromNBT(tagCompound);
|
|
this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInteger("CA"));
|
|
this.cropTypeB = BlockRegistry.getBlockById(tagCompound.getInteger("CB"));
|
|
this.cropTypeC = BlockRegistry.getBlockById(tagCompound.getInteger("CC"));
|
|
this.cropTypeD = BlockRegistry.getBlockById(tagCompound.getInteger("CD"));
|
|
}
|
|
|
|
private Block func_151559_a(Random rand)
|
|
{
|
|
switch (rand.zrange(5))
|
|
{
|
|
case 0:
|
|
return Blocks.carrot;
|
|
|
|
case 1:
|
|
return Blocks.potato;
|
|
|
|
default:
|
|
return Blocks.wheat;
|
|
}
|
|
}
|
|
|
|
public static StructureVillage.Field1 func_175851_a(StructureVillage.Start start, List<StructureComponent> p_175851_1_, Random rand, int p_175851_3_, int p_175851_4_, int p_175851_5_, Facing facing, int p_175851_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175851_3_, p_175851_4_, p_175851_5_, 0, 0, 0, 13, 4, 9, facing);
|
|
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175851_1_, structureboundingbox) == null ? new StructureVillage.Field1(start, p_175851_7_, rand, structureboundingbox, facing) : null;
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 12, 4, 8, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 7, Blocks.farmland.getState(), Blocks.farmland.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 1, 5, 0, 7, Blocks.farmland.getState(), Blocks.farmland.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 0, 1, 8, 0, 7, Blocks.farmland.getState(), Blocks.farmland.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 0, 1, 11, 0, 7, Blocks.farmland.getState(), Blocks.farmland.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 0, 8, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 0, 6, 0, 8, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 0, 0, 12, 0, 8, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 11, 0, 0, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 8, 11, 0, 8, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 1, 3, 0, 7, Blocks.water.getState(), Blocks.water.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 1, 9, 0, 7, Blocks.water.getState(), Blocks.water.getState(), false);
|
|
|
|
for (int i = 1; i <= 7; ++i)
|
|
{
|
|
this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(randomIn.range(2, 7)), 1, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(randomIn.range(2, 7)), 2, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(randomIn.range(2, 7)), 4, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(randomIn.range(2, 7)), 5, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(randomIn.range(2, 7)), 7, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(randomIn.range(2, 7)), 8, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeD.getStateFromMeta(randomIn.range(2, 7)), 10, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeD.getStateFromMeta(randomIn.range(2, 7)), 11, 1, i, structureBoundingBoxIn);
|
|
}
|
|
|
|
for (int k = 0; k < 9; ++k)
|
|
{
|
|
for (int j = 0; j < 13; ++j)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, j, 4, k, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.dirt.getState(), j, -1, k, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static class Field2 extends StructureVillage.Village
|
|
{
|
|
private Block cropTypeA;
|
|
private Block cropTypeB;
|
|
|
|
public Field2()
|
|
{
|
|
}
|
|
|
|
public Field2(StructureVillage.Start start, int p_i45569_2_, Random rand, StructureBoundingBox p_i45569_4_, Facing facing)
|
|
{
|
|
super(start, p_i45569_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45569_4_;
|
|
this.cropTypeA = this.func_151560_a(rand);
|
|
this.cropTypeB = this.func_151560_a(rand);
|
|
}
|
|
|
|
protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.writeStructureToNBT(tagCompound);
|
|
tagCompound.setInteger("CA", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeA));
|
|
tagCompound.setInteger("CB", BlockRegistry.REGISTRY.getIDForObject(this.cropTypeB));
|
|
}
|
|
|
|
protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.readStructureFromNBT(tagCompound);
|
|
this.cropTypeA = BlockRegistry.getBlockById(tagCompound.getInteger("CA"));
|
|
this.cropTypeB = BlockRegistry.getBlockById(tagCompound.getInteger("CB"));
|
|
}
|
|
|
|
private Block func_151560_a(Random rand)
|
|
{
|
|
switch (rand.zrange(5))
|
|
{
|
|
case 0:
|
|
return Blocks.carrot;
|
|
|
|
case 1:
|
|
return Blocks.potato;
|
|
|
|
default:
|
|
return Blocks.wheat;
|
|
}
|
|
}
|
|
|
|
public static StructureVillage.Field2 func_175852_a(StructureVillage.Start start, List<StructureComponent> p_175852_1_, Random rand, int p_175852_3_, int p_175852_4_, int p_175852_5_, Facing facing, int p_175852_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175852_3_, p_175852_4_, p_175852_5_, 0, 0, 0, 7, 4, 9, facing);
|
|
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175852_1_, structureboundingbox) == null ? new StructureVillage.Field2(start, p_175852_7_, rand, structureboundingbox, facing) : null;
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 6, 4, 8, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 7, Blocks.farmland.getState(), Blocks.farmland.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 1, 5, 0, 7, Blocks.farmland.getState(), Blocks.farmland.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 0, 8, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 0, 6, 0, 8, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 5, 0, 0, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 8, 5, 0, 8, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 1, 3, 0, 7, Blocks.water.getState(), Blocks.water.getState(), false);
|
|
|
|
for (int i = 1; i <= 7; ++i)
|
|
{
|
|
this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(randomIn.range(2, 7)), 1, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(randomIn.range(2, 7)), 2, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(randomIn.range(2, 7)), 4, 1, i, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(randomIn.range(2, 7)), 5, 1, i, structureBoundingBoxIn);
|
|
}
|
|
|
|
for (int k = 0; k < 9; ++k)
|
|
{
|
|
for (int j = 0; j < 7; ++j)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, j, 4, k, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.dirt.getState(), j, -1, k, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static class Hall extends StructureVillage.Village
|
|
{
|
|
public Hall()
|
|
{
|
|
}
|
|
|
|
public Hall(StructureVillage.Start start, int p_i45567_2_, Random rand, StructureBoundingBox p_i45567_4_, Facing facing)
|
|
{
|
|
super(start, p_i45567_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45567_4_;
|
|
}
|
|
|
|
public static StructureVillage.Hall func_175857_a(StructureVillage.Start start, List<StructureComponent> p_175857_1_, Random rand, int p_175857_3_, int p_175857_4_, int p_175857_5_, Facing facing, int p_175857_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175857_3_, p_175857_4_, p_175857_5_, 0, 0, 0, 9, 7, 11, facing);
|
|
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175857_1_, structureboundingbox) == null ? new StructureVillage.Hall(start, p_175857_7_, rand, structureboundingbox, facing) : null;
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 7 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 4, 4, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 8, 4, 10, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 6, 8, 0, 10, Blocks.dirt.getState(), Blocks.dirt.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 6, 0, 6, structureBoundingBoxIn);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 2, 1, 10, Blocks.oak_fence.getState(), Blocks.oak_fence.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 6, 8, 1, 10, Blocks.oak_fence.getState(), Blocks.oak_fence.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 10, 7, 1, 10, Blocks.oak_fence.getState(), Blocks.oak_fence.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 7, 0, 4, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 3, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 0, 8, 3, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 7, 1, 0, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 5, 7, 1, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 3, 0, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 7, 3, 5, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 1, 8, 4, 1, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 4, 8, 4, 4, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 2, 8, 5, 3, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 0, 4, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 0, 4, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 8, 4, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 8, 4, 3, structureBoundingBoxIn);
|
|
int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3);
|
|
int j = this.getMetadataWithOffset(Blocks.oak_stairs, 2);
|
|
|
|
for (int k = -1; k <= 2; ++k)
|
|
{
|
|
for (int l = 0; l <= 8; ++l)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i), l, 4 + k, k, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j), l, 4 + k, 5 - k, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 0, 2, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 0, 2, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 8, 2, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 8, 2, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 2, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 3, 2, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 5, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 6, 2, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 2, 1, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getState(), 2, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 1, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 3)), 2, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 1)), 1, 1, 3, structureBoundingBoxIn);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 0, 1, 7, 0, 3, Blocks.stone_slab.getState().withProperty(BlockSlab.DOUBLE, true), Blocks.stone_slab.getState().withProperty(BlockSlab.DOUBLE, true), false);
|
|
this.setBlockState(worldIn, Blocks.stone_slab.getState().withProperty(BlockSlab.DOUBLE, true), 6, 1, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.stone_slab.getState().withProperty(BlockSlab.DOUBLE, true), 6, 1, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 2, 1, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 2, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 3, 1, structureBoundingBoxIn);
|
|
this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 2, 1, 0, Facing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
|
|
|
if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn);
|
|
}
|
|
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 6, 1, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 6, 2, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 6, 3, 4, structureBoundingBoxIn);
|
|
this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 6, 1, 5, Facing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
|
|
|
for (int i1 = 0; i1 < 5; ++i1)
|
|
{
|
|
for (int j1 = 0; j1 < 9; ++j1)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, j1, 7, i1, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getState(), j1, -1, i1, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.spawnVillagers(worldIn, structureBoundingBoxIn, 4, 1, 2, 2);
|
|
return true;
|
|
}
|
|
|
|
// protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
|
// {
|
|
// return p_180779_1_ == 0 ? 4 : super.func_180779_c(p_180779_1_, p_180779_2_);
|
|
// }
|
|
}
|
|
|
|
public static class House1 extends StructureVillage.Village
|
|
{
|
|
public House1()
|
|
{
|
|
}
|
|
|
|
public House1(StructureVillage.Start start, int p_i45571_2_, Random rand, StructureBoundingBox p_i45571_4_, Facing facing)
|
|
{
|
|
super(start, p_i45571_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45571_4_;
|
|
}
|
|
|
|
public static StructureVillage.House1 func_175850_a(StructureVillage.Start start, List<StructureComponent> p_175850_1_, Random rand, int p_175850_3_, int p_175850_4_, int p_175850_5_, Facing facing, int p_175850_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175850_3_, p_175850_4_, p_175850_5_, 0, 0, 0, 9, 9, 6, facing);
|
|
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175850_1_, structureboundingbox) == null ? new StructureVillage.House1(start, p_175850_7_, rand, structureboundingbox, facing) : null;
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 9 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 5, 4, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 8, 0, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 8, 5, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 1, 8, 6, 4, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 7, 2, 8, 7, 3, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3);
|
|
int j = this.getMetadataWithOffset(Blocks.oak_stairs, 2);
|
|
|
|
for (int k = -1; k <= 2; ++k)
|
|
{
|
|
for (int l = 0; l <= 8; ++l)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i), l, 6 + k, k, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j), l, 6 + k, 5 - k, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 1, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 5, 8, 1, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 0, 8, 1, 4, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 0, 7, 1, 0, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 4, 0, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 5, 0, 4, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 2, 5, 8, 4, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 2, 0, 8, 4, 0, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 1, 0, 4, 4, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 7, 4, 5, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 2, 1, 8, 4, 4, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 4, 0, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 4, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 5, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 6, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 4, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 5, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 6, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 3, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 3, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 3, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 3, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 2, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 3, 2, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 5, 2, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 6, 2, 5, structureBoundingBoxIn);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 7, 4, 1, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 4, 7, 4, 4, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 7, 3, 4, Blocks.bookshelf.getState(), Blocks.bookshelf.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 7, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 0)), 7, 1, 3, structureBoundingBoxIn);
|
|
int j1 = this.getMetadataWithOffset(Blocks.oak_stairs, 3);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 6, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 5, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 4, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 3, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 6, 1, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getState(), 6, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 1, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getState(), 4, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.crafting_table.getState(), 7, 1, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 1, 1, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 1, 2, 0, structureBoundingBoxIn);
|
|
this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, Facing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
|
|
|
if (this.getBlockStateFromPos(worldIn, 1, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), 1, 0, -1, structureBoundingBoxIn);
|
|
}
|
|
|
|
for (int k1 = 0; k1 < 6; ++k1)
|
|
{
|
|
for (int i1 = 0; i1 < 9; ++i1)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, i1, 9, k1, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getState(), i1, -1, k1, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.spawnVillagers(worldIn, structureBoundingBoxIn, 2, 1, 2, 1);
|
|
return true;
|
|
}
|
|
|
|
// protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
|
// {
|
|
// return 1;
|
|
// }
|
|
}
|
|
|
|
public static class House2 extends StructureVillage.Village
|
|
{
|
|
private boolean hasMadeChest;
|
|
|
|
public House2()
|
|
{
|
|
}
|
|
|
|
public House2(StructureVillage.Start start, int p_i45563_2_, Random rand, StructureBoundingBox p_i45563_4_, Facing facing)
|
|
{
|
|
super(start, p_i45563_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45563_4_;
|
|
}
|
|
|
|
public static StructureVillage.House2 func_175855_a(StructureVillage.Start start, List<StructureComponent> p_175855_1_, Random rand, int p_175855_3_, int p_175855_4_, int p_175855_5_, Facing facing, int p_175855_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175855_3_, p_175855_4_, p_175855_5_, 0, 0, 0, 10, 6, 7, facing);
|
|
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175855_1_, structureboundingbox) == null ? new StructureVillage.House2(start, p_175855_7_, rand, structureboundingbox, facing) : null;
|
|
}
|
|
|
|
protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.writeStructureToNBT(tagCompound);
|
|
tagCompound.setBoolean("Chest", this.hasMadeChest);
|
|
}
|
|
|
|
protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.readStructureFromNBT(tagCompound);
|
|
this.hasMadeChest = tagCompound.getBoolean("Chest");
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 9, 4, 6, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 9, 0, 6, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 9, 4, 6, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 9, 5, 6, Blocks.stone_slab.getState(), Blocks.stone_slab.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 8, 5, 5, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 4, 0, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 3, 4, 0, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 6, 0, 4, 6, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 3, 3, 1, structureBoundingBoxIn);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 2, 3, 3, 2, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 3, 5, 3, 3, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 5, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 6, 5, 3, 6, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 0, 5, 3, 0, Blocks.oak_fence.getState(), Blocks.oak_fence.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 1, 0, 9, 3, 0, Blocks.oak_fence.getState(), Blocks.oak_fence.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 4, 9, 4, 6, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.flowing_lava.getState(), 7, 1, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.flowing_lava.getState(), 8, 1, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.iron_bars.getState(), 9, 2, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.iron_bars.getState(), 9, 2, 4, structureBoundingBoxIn);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 4, 8, 2, 5, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 6, 1, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.furnace.getState(), 6, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.furnace.getState(), 6, 3, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.stone_slab.getState().withProperty(BlockSlab.DOUBLE, true), 8, 1, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 2, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 4, 2, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 2, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getState(), 2, 2, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 1, 1, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 3)), 2, 1, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 1)), 1, 1, 4, structureBoundingBoxIn);
|
|
|
|
if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5))))
|
|
{
|
|
this.hasMadeChest = true;
|
|
this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, LootConstants.VILLAGE_BLACKSMITH, 3 + randomIn.zrange(6));
|
|
}
|
|
|
|
for (int i = 6; i <= 8; ++i)
|
|
{
|
|
if (this.getBlockStateFromPos(worldIn, i, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, i, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), i, 0, -1, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
for (int k = 0; k < 7; ++k)
|
|
{
|
|
for (int j = 0; j < 10; ++j)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, k, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getState(), j, -1, k, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.spawnVillagers(worldIn, structureBoundingBoxIn, 7, 1, 1, 1);
|
|
return true;
|
|
}
|
|
|
|
// protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
|
// {
|
|
// return 3;
|
|
// }
|
|
}
|
|
|
|
public static class House3 extends StructureVillage.Village
|
|
{
|
|
public House3()
|
|
{
|
|
}
|
|
|
|
public House3(StructureVillage.Start start, int p_i45561_2_, Random rand, StructureBoundingBox p_i45561_4_, Facing facing)
|
|
{
|
|
super(start, p_i45561_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45561_4_;
|
|
}
|
|
|
|
public static StructureVillage.House3 func_175849_a(StructureVillage.Start start, List<StructureComponent> p_175849_1_, Random rand, int p_175849_3_, int p_175849_4_, int p_175849_5_, Facing facing, int p_175849_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175849_3_, p_175849_4_, p_175849_5_, 0, 0, 0, 9, 7, 12, facing);
|
|
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175849_1_, structureboundingbox) == null ? new StructureVillage.House3(start, p_175849_7_, rand, structureboundingbox, facing) : null;
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 7 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 4, 4, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 8, 4, 10, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 5, 8, 0, 10, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 7, 0, 4, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 3, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 0, 8, 3, 10, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 7, 2, 0, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 5, 2, 1, 5, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 6, 2, 3, 10, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 10, 7, 3, 10, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 3, 0, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 2, 3, 5, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 1, 8, 4, 1, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 4, 3, 4, 4, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 2, 8, 5, 3, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 0, 4, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 0, 4, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 8, 4, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 8, 4, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 8, 4, 4, structureBoundingBoxIn);
|
|
int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3);
|
|
int j = this.getMetadataWithOffset(Blocks.oak_stairs, 2);
|
|
|
|
for (int k = -1; k <= 2; ++k)
|
|
{
|
|
for (int l = 0; l <= 8; ++l)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i), l, 4 + k, k, structureBoundingBoxIn);
|
|
|
|
if ((k > -1 || l <= 1) && (k > 0 || l <= 3) && (k > 1 || l <= 4 || l >= 6))
|
|
{
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j), l, 4 + k, 5 - k, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 4, 5, 3, 4, 10, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 4, 2, 7, 4, 10, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 4, 4, 5, 10, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 5, 4, 6, 5, 10, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 6, 3, 5, 6, 10, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
int k1 = this.getMetadataWithOffset(Blocks.oak_stairs, 0);
|
|
|
|
for (int l1 = 4; l1 >= 1; --l1)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), l1, 2 + l1, 7 - l1, structureBoundingBoxIn);
|
|
|
|
for (int i1 = 8 - l1; i1 <= 10; ++i1)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(k1), l1, 2 + l1, i1, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
int i2 = this.getMetadataWithOffset(Blocks.oak_stairs, 1);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 6, 6, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 7, 5, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i2), 6, 6, 4, structureBoundingBoxIn);
|
|
|
|
for (int j2 = 6; j2 <= 8; ++j2)
|
|
{
|
|
for (int j1 = 5; j1 <= 10; ++j1)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i2), j2, 12 - j2, j1, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 0, 2, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 0, 2, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 4, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 5, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 6, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 8, 2, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 8, 2, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 8, 2, 5, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 8, 2, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 2, 7, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 8, 2, 8, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 8, 2, 9, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 2, 2, 6, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 2, 7, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 2, 8, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 2, 2, 9, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 4, 4, 10, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 5, 4, 10, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 6, 4, 10, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 5, 5, 10, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 2, 1, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 2, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 3, 1, structureBoundingBoxIn);
|
|
this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 2, 1, 0, Facing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, -1, 3, 2, -1, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
|
|
if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn);
|
|
}
|
|
|
|
for (int k2 = 0; k2 < 5; ++k2)
|
|
{
|
|
for (int i3 = 0; i3 < 9; ++i3)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, i3, 7, k2, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getState(), i3, -1, k2, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
for (int l2 = 5; l2 < 11; ++l2)
|
|
{
|
|
for (int j3 = 2; j3 < 9; ++j3)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, j3, 7, l2, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getState(), j3, -1, l2, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.spawnVillagers(worldIn, structureBoundingBoxIn, 4, 1, 2, 2);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static class House4Garden extends StructureVillage.Village
|
|
{
|
|
private boolean isRoofAccessible;
|
|
|
|
public House4Garden()
|
|
{
|
|
}
|
|
|
|
public House4Garden(StructureVillage.Start start, int p_i45566_2_, Random rand, StructureBoundingBox p_i45566_4_, Facing facing)
|
|
{
|
|
super(start, p_i45566_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45566_4_;
|
|
this.isRoofAccessible = rand.chance();
|
|
}
|
|
|
|
protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.writeStructureToNBT(tagCompound);
|
|
tagCompound.setBoolean("Terrace", this.isRoofAccessible);
|
|
}
|
|
|
|
protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.readStructureFromNBT(tagCompound);
|
|
this.isRoofAccessible = tagCompound.getBoolean("Terrace");
|
|
}
|
|
|
|
public static StructureVillage.House4Garden func_175858_a(StructureVillage.Start start, List<StructureComponent> p_175858_1_, Random rand, int p_175858_3_, int p_175858_4_, int p_175858_5_, Facing facing, int p_175858_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175858_3_, p_175858_4_, p_175858_5_, 0, 0, 0, 5, 6, 5, facing);
|
|
return StructureComponent.findIntersecting(p_175858_1_, structureboundingbox) != null ? null : new StructureVillage.House4Garden(start, p_175858_7_, rand, structureboundingbox, facing);
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 0, 4, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 4, 4, 4, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 3, 4, 3, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 0, 1, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 0, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 0, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 4, 1, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 4, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 4, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 0, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 0, 2, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 0, 3, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 4, 1, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 4, 2, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.cobblestone.getState(), 4, 3, 4, structureBoundingBoxIn);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 3, 3, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 3, 3, 4, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 2, 2, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 4, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 1, 1, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 1, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 1, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 2, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 3, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 3, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_planks.getState(), 3, 1, 0, structureBoundingBoxIn);
|
|
|
|
if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 3, 3, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
|
|
if (this.isRoofAccessible)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 0, 5, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 5, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 2, 5, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 3, 5, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 5, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 0, 5, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 5, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 2, 5, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 3, 5, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 5, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 5, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 5, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 5, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 0, 5, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 0, 5, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 0, 5, 3, structureBoundingBoxIn);
|
|
}
|
|
|
|
if (this.isRoofAccessible)
|
|
{
|
|
int i = this.getMetadataWithOffset(Blocks.ladder, 3);
|
|
this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 1, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 2, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 3, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 4, 3, structureBoundingBoxIn);
|
|
}
|
|
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 3, 1, structureBoundingBoxIn);
|
|
|
|
for (int k = 0; k < 5; ++k)
|
|
{
|
|
for (int j = 0; j < 5; ++j)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, k, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getState(), j, -1, k, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.spawnVillagers(worldIn, structureBoundingBoxIn, 1, 1, 2, 1);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static class Path extends StructureVillage.Road
|
|
{
|
|
private int length;
|
|
|
|
public Path()
|
|
{
|
|
}
|
|
|
|
public Path(StructureVillage.Start start, int p_i45562_2_, Random rand, StructureBoundingBox p_i45562_4_, Facing facing)
|
|
{
|
|
super(start, p_i45562_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45562_4_;
|
|
this.length = Math.max(p_i45562_4_.getXSize(), p_i45562_4_.getZSize());
|
|
}
|
|
|
|
protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.writeStructureToNBT(tagCompound);
|
|
tagCompound.setInteger("Length", this.length);
|
|
}
|
|
|
|
protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.readStructureFromNBT(tagCompound);
|
|
this.length = tagCompound.getInteger("Length");
|
|
}
|
|
|
|
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
|
|
{
|
|
boolean flag = false;
|
|
|
|
for (int i = rand.zrange(5); i < this.length - 8; i += 2 + rand.zrange(5))
|
|
{
|
|
StructureComponent structurecomponent = this.getNextComponentNN((StructureVillage.Start)componentIn, listIn, rand, 0, i);
|
|
|
|
if (structurecomponent != null)
|
|
{
|
|
i += Math.max(structurecomponent.boundingBox.getXSize(), structurecomponent.boundingBox.getZSize());
|
|
flag = true;
|
|
}
|
|
}
|
|
|
|
for (int j = rand.zrange(5); j < this.length - 8; j += 2 + rand.zrange(5))
|
|
{
|
|
StructureComponent structurecomponent1 = this.getNextComponentPP((StructureVillage.Start)componentIn, listIn, rand, 0, j);
|
|
|
|
if (structurecomponent1 != null)
|
|
{
|
|
j += Math.max(structurecomponent1.boundingBox.getXSize(), structurecomponent1.boundingBox.getZSize());
|
|
flag = true;
|
|
}
|
|
}
|
|
|
|
if (flag && rand.zrange(3) > 0 && this.coordBaseMode != null)
|
|
{
|
|
switch (this.coordBaseMode)
|
|
{
|
|
case NORTH:
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, Facing.WEST, this.getComponentType());
|
|
break;
|
|
|
|
case SOUTH:
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, Facing.WEST, this.getComponentType());
|
|
break;
|
|
|
|
case WEST:
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, Facing.NORTH, this.getComponentType());
|
|
break;
|
|
|
|
case EAST:
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.minZ - 1, Facing.NORTH, this.getComponentType());
|
|
}
|
|
}
|
|
|
|
if (flag && rand.zrange(3) > 0 && this.coordBaseMode != null)
|
|
{
|
|
switch (this.coordBaseMode)
|
|
{
|
|
case NORTH:
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, Facing.EAST, this.getComponentType());
|
|
break;
|
|
|
|
case SOUTH:
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, Facing.EAST, this.getComponentType());
|
|
break;
|
|
|
|
case WEST:
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, Facing.SOUTH, this.getComponentType());
|
|
break;
|
|
|
|
case EAST:
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.maxZ + 1, Facing.SOUTH, this.getComponentType());
|
|
}
|
|
}
|
|
}
|
|
|
|
public static StructureBoundingBox func_175848_a(StructureVillage.Start start, List<StructureComponent> p_175848_1_, Random rand, int p_175848_3_, int p_175848_4_, int p_175848_5_, Facing facing)
|
|
{
|
|
for (int i = 7 * rand.range(3, 5); i >= 7; i -= 7)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175848_3_, p_175848_4_, p_175848_5_, 0, 0, 0, 3, 3, i, facing);
|
|
|
|
if (StructureComponent.findIntersecting(p_175848_1_, structureboundingbox) == null)
|
|
{
|
|
return structureboundingbox;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
State iblockstate = this.func_175847_a(Blocks.gravel.getState());
|
|
State iblockstate1 = this.func_175847_a(Blocks.cobblestone.getState());
|
|
|
|
for (int i = this.boundingBox.minX; i <= this.boundingBox.maxX; ++i)
|
|
{
|
|
for (int j = this.boundingBox.minZ; j <= this.boundingBox.maxZ; ++j)
|
|
{
|
|
BlockPos blockpos = new BlockPos(i, 64, j);
|
|
|
|
if (structureBoundingBoxIn.isVecInside(blockpos))
|
|
{
|
|
blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos).down();
|
|
worldIn.setState(blockpos, iblockstate, 2);
|
|
worldIn.setState(blockpos.down(), iblockstate1, 2);
|
|
}
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static class PieceWeight
|
|
{
|
|
public Class <? extends StructureVillage.Village > villagePieceClass;
|
|
public final int villagePieceWeight;
|
|
public int villagePiecesSpawned;
|
|
public int villagePiecesLimit;
|
|
|
|
public PieceWeight(Class <? extends StructureVillage.Village > p_i2098_1_, int p_i2098_2_, int p_i2098_3_)
|
|
{
|
|
this.villagePieceClass = p_i2098_1_;
|
|
this.villagePieceWeight = p_i2098_2_;
|
|
this.villagePiecesLimit = p_i2098_3_;
|
|
}
|
|
|
|
public boolean canSpawnMoreVillagePiecesOfType(int p_75085_1_)
|
|
{
|
|
return this.villagePiecesLimit == 0 || this.villagePiecesSpawned < this.villagePiecesLimit;
|
|
}
|
|
|
|
public boolean canSpawnMoreVillagePieces()
|
|
{
|
|
return this.villagePiecesLimit == 0 || this.villagePiecesSpawned < this.villagePiecesLimit;
|
|
}
|
|
}
|
|
|
|
public abstract static class Road extends StructureVillage.Village
|
|
{
|
|
public Road()
|
|
{
|
|
}
|
|
|
|
protected Road(StructureVillage.Start start, int type)
|
|
{
|
|
super(start, type);
|
|
}
|
|
}
|
|
|
|
public static class Start extends StructureVillage.Well
|
|
{
|
|
public BiomeGenerator biomeGen;
|
|
public boolean inDesert;
|
|
public int terrainType;
|
|
public StructureVillage.PieceWeight structVillagePieceWeight;
|
|
public List<StructureVillage.PieceWeight> structureVillageWeightedPieceList;
|
|
public List<StructureComponent> field_74932_i = Lists.<StructureComponent>newArrayList();
|
|
public List<StructureComponent> field_74930_j = Lists.<StructureComponent>newArrayList();
|
|
|
|
public Start()
|
|
{
|
|
}
|
|
|
|
public Start(BiomeGenerator genIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureVillage.PieceWeight> p_i2104_6_, int p_i2104_7_)
|
|
{
|
|
super((StructureVillage.Start)null, 0, rand, p_i2104_4_, p_i2104_5_);
|
|
this.biomeGen = genIn;
|
|
this.structureVillageWeightedPieceList = p_i2104_6_;
|
|
this.terrainType = p_i2104_7_;
|
|
Biome biomegenbase = genIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biome.DEF_BIOME);
|
|
this.inDesert = biomegenbase == Biome.desert || biomegenbase == Biome.desertHills;
|
|
this.func_175846_a(this.inDesert);
|
|
}
|
|
|
|
public BiomeGenerator getBiomeGenerator()
|
|
{
|
|
return this.biomeGen;
|
|
}
|
|
}
|
|
|
|
public static class Torch extends StructureVillage.Village
|
|
{
|
|
public Torch()
|
|
{
|
|
}
|
|
|
|
public Torch(StructureVillage.Start start, int p_i45568_2_, Random rand, StructureBoundingBox p_i45568_4_, Facing facing)
|
|
{
|
|
super(start, p_i45568_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45568_4_;
|
|
}
|
|
|
|
public static StructureBoundingBox func_175856_a(StructureVillage.Start start, List<StructureComponent> p_175856_1_, Random rand, int p_175856_3_, int p_175856_4_, int p_175856_5_, Facing facing)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175856_3_, p_175856_4_, p_175856_5_, 0, 0, 0, 3, 4, 2, facing);
|
|
return StructureComponent.findIntersecting(p_175856_1_, structureboundingbox) != null ? null : structureboundingbox;
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 0, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 1, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 2, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(DyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn);
|
|
boolean flag = this.coordBaseMode == Facing.EAST || this.coordBaseMode == Facing.NORTH;
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.torch.getState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, structureBoundingBoxIn);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
abstract static class Village extends StructureComponent
|
|
{
|
|
protected int field_143015_k = -1;
|
|
private int villagersSpawned;
|
|
private boolean isDesertVillage;
|
|
|
|
public Village()
|
|
{
|
|
}
|
|
|
|
protected Village(StructureVillage.Start start, int type)
|
|
{
|
|
super(type);
|
|
|
|
if (start != null)
|
|
{
|
|
this.isDesertVillage = start.inDesert;
|
|
}
|
|
}
|
|
|
|
protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
|
{
|
|
tagCompound.setInteger("HPos", this.field_143015_k);
|
|
tagCompound.setInteger("VCount", this.villagersSpawned);
|
|
tagCompound.setBoolean("Desert", this.isDesertVillage);
|
|
}
|
|
|
|
protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
|
{
|
|
this.field_143015_k = tagCompound.getInteger("HPos");
|
|
this.villagersSpawned = tagCompound.getInteger("VCount");
|
|
this.isDesertVillage = tagCompound.getBoolean("Desert");
|
|
}
|
|
|
|
protected StructureComponent getNextComponentNN(StructureVillage.Start start, List<StructureComponent> p_74891_2_, Random rand, int p_74891_4_, int p_74891_5_)
|
|
{
|
|
if (this.coordBaseMode != null)
|
|
{
|
|
switch (this.coordBaseMode)
|
|
{
|
|
case NORTH:
|
|
return StructureVillage.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX - 1, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ + p_74891_5_, Facing.WEST, this.getComponentType());
|
|
|
|
case SOUTH:
|
|
return StructureVillage.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX - 1, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ + p_74891_5_, Facing.WEST, this.getComponentType());
|
|
|
|
case WEST:
|
|
return StructureVillage.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX + p_74891_5_, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ - 1, Facing.NORTH, this.getComponentType());
|
|
|
|
case EAST:
|
|
return StructureVillage.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX + p_74891_5_, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ - 1, Facing.NORTH, this.getComponentType());
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
protected StructureComponent getNextComponentPP(StructureVillage.Start start, List<StructureComponent> p_74894_2_, Random rand, int p_74894_4_, int p_74894_5_)
|
|
{
|
|
if (this.coordBaseMode != null)
|
|
{
|
|
switch (this.coordBaseMode)
|
|
{
|
|
case NORTH:
|
|
return StructureVillage.func_176066_d(start, p_74894_2_, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74894_4_, this.boundingBox.minZ + p_74894_5_, Facing.EAST, this.getComponentType());
|
|
|
|
case SOUTH:
|
|
return StructureVillage.func_176066_d(start, p_74894_2_, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74894_4_, this.boundingBox.minZ + p_74894_5_, Facing.EAST, this.getComponentType());
|
|
|
|
case WEST:
|
|
return StructureVillage.func_176066_d(start, p_74894_2_, rand, this.boundingBox.minX + p_74894_5_, this.boundingBox.minY + p_74894_4_, this.boundingBox.maxZ + 1, Facing.SOUTH, this.getComponentType());
|
|
|
|
case EAST:
|
|
return StructureVillage.func_176066_d(start, p_74894_2_, rand, this.boundingBox.minX + p_74894_5_, this.boundingBox.minY + p_74894_4_, this.boundingBox.maxZ + 1, Facing.SOUTH, this.getComponentType());
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
protected int getAverageGroundLevel(WorldServer worldIn, StructureBoundingBox p_74889_2_)
|
|
{
|
|
int i = 0;
|
|
int j = 0;
|
|
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
|
|
|
for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k)
|
|
{
|
|
for (int l = this.boundingBox.minX; l <= this.boundingBox.maxX; ++l)
|
|
{
|
|
blockpos$mutableblockpos.set(l, 64, k);
|
|
|
|
if (p_74889_2_.isVecInside(blockpos$mutableblockpos))
|
|
{
|
|
i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.getSeaLevel());
|
|
++j;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (j == 0)
|
|
{
|
|
return -1;
|
|
}
|
|
else
|
|
{
|
|
return i / j;
|
|
}
|
|
}
|
|
|
|
protected static boolean canVillageGoDeeper(StructureBoundingBox p_74895_0_)
|
|
{
|
|
return p_74895_0_ != null && p_74895_0_.minY > 10;
|
|
}
|
|
|
|
protected void spawnVillagers(WorldServer worldIn, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
|
|
{
|
|
if (this.villagersSpawned < p_74893_6_ && Config.mobs && Config.spawnVillager)
|
|
{
|
|
for (int i = this.villagersSpawned; i < p_74893_6_; ++i)
|
|
{
|
|
int j = this.getXWithOffset(p_74893_3_ + i, p_74893_5_);
|
|
int k = this.getYWithOffset(p_74893_4_);
|
|
int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_);
|
|
|
|
if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
|
|
{
|
|
break;
|
|
}
|
|
|
|
++this.villagersSpawned;
|
|
EntityHuman entity = new EntityHuman(worldIn);
|
|
entity.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
|
|
entity.onInitialSpawn(null);
|
|
// entityvillager.setProfession(this.func_180779_c(i, entityvillager.getProfession()));
|
|
worldIn.spawnEntityInWorld(entity);
|
|
}
|
|
}
|
|
}
|
|
|
|
// protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
|
// {
|
|
// return p_180779_2_;
|
|
// }
|
|
|
|
protected State func_175847_a(State p_175847_1_)
|
|
{
|
|
if (this.isDesertVillage)
|
|
{
|
|
if (p_175847_1_.getBlock() instanceof BlockLog)
|
|
{
|
|
return Blocks.sandstone.getState();
|
|
}
|
|
|
|
if (p_175847_1_.getBlock() == Blocks.cobblestone)
|
|
{
|
|
return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.DEFAULT.getMetadata());
|
|
}
|
|
|
|
if (p_175847_1_.getBlock() == Blocks.oak_planks)
|
|
{
|
|
return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata());
|
|
}
|
|
|
|
if (p_175847_1_.getBlock() == Blocks.oak_stairs)
|
|
{
|
|
return Blocks.sandstone_stairs.getState().withProperty(BlockStairs.FACING, p_175847_1_.getValue(BlockStairs.FACING));
|
|
}
|
|
|
|
if (p_175847_1_.getBlock() == Blocks.cobblestone_stairs)
|
|
{
|
|
return Blocks.sandstone_stairs.getState().withProperty(BlockStairs.FACING, p_175847_1_.getValue(BlockStairs.FACING));
|
|
}
|
|
|
|
if (p_175847_1_.getBlock() == Blocks.gravel)
|
|
{
|
|
return Blocks.sandstone.getState();
|
|
}
|
|
}
|
|
|
|
return p_175847_1_;
|
|
}
|
|
|
|
protected void setBlockState(WorldServer worldIn, State blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn)
|
|
{
|
|
State iblockstate = this.func_175847_a(blockstateIn);
|
|
super.setBlockState(worldIn, iblockstate, x, y, z, boundingboxIn);
|
|
}
|
|
|
|
protected void fillWithBlocks(WorldServer worldIn, StructureBoundingBox boundingboxIn, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, State boundaryBlockState, State insideBlockState, boolean existingOnly)
|
|
{
|
|
State iblockstate = this.func_175847_a(boundaryBlockState);
|
|
State iblockstate1 = this.func_175847_a(insideBlockState);
|
|
super.fillWithBlocks(worldIn, boundingboxIn, xMin, yMin, zMin, xMax, yMax, zMax, iblockstate, iblockstate1, existingOnly);
|
|
}
|
|
|
|
protected void replaceAirAndLiquidDownwards(WorldServer worldIn, State blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn)
|
|
{
|
|
State iblockstate = this.func_175847_a(blockstateIn);
|
|
super.replaceAirAndLiquidDownwards(worldIn, iblockstate, x, y, z, boundingboxIn);
|
|
}
|
|
|
|
protected void func_175846_a(boolean p_175846_1_)
|
|
{
|
|
this.isDesertVillage = p_175846_1_;
|
|
}
|
|
}
|
|
|
|
public static class Well extends StructureVillage.Village
|
|
{
|
|
public Well()
|
|
{
|
|
}
|
|
|
|
public Well(StructureVillage.Start start, int p_i2109_2_, Random rand, int p_i2109_4_, int p_i2109_5_)
|
|
{
|
|
super(start, p_i2109_2_);
|
|
this.coordBaseMode = Facing.Plane.HORIZONTAL.random(rand);
|
|
|
|
switch (this.coordBaseMode)
|
|
{
|
|
case NORTH:
|
|
case SOUTH:
|
|
this.boundingBox = new StructureBoundingBox(p_i2109_4_, 64, p_i2109_5_, p_i2109_4_ + 6 - 1, 78, p_i2109_5_ + 6 - 1);
|
|
break;
|
|
|
|
default:
|
|
this.boundingBox = new StructureBoundingBox(p_i2109_4_, 64, p_i2109_5_, p_i2109_4_ + 6 - 1, 78, p_i2109_5_ + 6 - 1);
|
|
}
|
|
}
|
|
|
|
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
|
|
{
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, Facing.WEST, this.getComponentType());
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, Facing.EAST, this.getComponentType());
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ - 1, Facing.NORTH, this.getComponentType());
|
|
StructureVillage.func_176069_e((StructureVillage.Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.maxZ + 1, Facing.SOUTH, this.getComponentType());
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 3, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 4, 12, 4, Blocks.cobblestone.getState(), Blocks.flowing_water.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 2, 12, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 3, 12, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 2, 12, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 3, 12, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 13, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 14, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 13, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 14, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 13, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 1, 14, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 13, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), 4, 14, 4, structureBoundingBoxIn);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 15, 1, 4, 15, 4, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
|
|
for (int i = 0; i <= 5; ++i)
|
|
{
|
|
for (int j = 0; j <= 5; ++j)
|
|
{
|
|
if (j == 0 || j == 5 || i == 0 || i == 5)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.gravel.getState(), j, 11, i, structureBoundingBoxIn);
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, j, 12, i, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static class WoodHut extends StructureVillage.Village
|
|
{
|
|
private boolean isTallHouse;
|
|
private int tablePosition;
|
|
|
|
public WoodHut()
|
|
{
|
|
}
|
|
|
|
public WoodHut(StructureVillage.Start start, int p_i45565_2_, Random rand, StructureBoundingBox p_i45565_4_, Facing facing)
|
|
{
|
|
super(start, p_i45565_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45565_4_;
|
|
this.isTallHouse = rand.chance();
|
|
this.tablePosition = rand.zrange(3);
|
|
}
|
|
|
|
protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.writeStructureToNBT(tagCompound);
|
|
tagCompound.setInteger("T", this.tablePosition);
|
|
tagCompound.setBoolean("C", this.isTallHouse);
|
|
}
|
|
|
|
protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.readStructureFromNBT(tagCompound);
|
|
this.tablePosition = tagCompound.getInteger("T");
|
|
this.isTallHouse = tagCompound.getBoolean("C");
|
|
}
|
|
|
|
public static StructureVillage.WoodHut func_175853_a(StructureVillage.Start start, List<StructureComponent> p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, Facing facing, int p_175853_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175853_3_, p_175853_4_, p_175853_5_, 0, 0, 0, 4, 6, 5, facing);
|
|
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new StructureVillage.WoodHut(start, p_175853_7_, rand, structureboundingbox, facing) : null;
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 5, 4, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 3, 0, 4, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 3, Blocks.dirt.getState(), Blocks.dirt.getState(), false);
|
|
|
|
if (this.isTallHouse)
|
|
{
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 2, 4, 3, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
}
|
|
else
|
|
{
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 2, 5, 3, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
}
|
|
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 1, 4, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 2, 4, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 1, 4, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 2, 4, 4, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 0, 4, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 0, 4, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 0, 4, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 3, 4, 1, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 3, 4, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.oak_log.getState(), 3, 4, 3, structureBoundingBoxIn);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 3, 0, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 3, 3, 0, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 4, 0, 3, 4, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 4, 3, 3, 4, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 1, 3, 3, 3, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 2, 3, 4, Blocks.oak_planks.getState(), Blocks.oak_planks.getState(), false);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 0, 2, 2, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.glass_pane.getState(), 3, 2, 2, structureBoundingBoxIn);
|
|
|
|
if (this.tablePosition > 0)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.oak_fence.getState(), this.tablePosition, 1, 3, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getState(), this.tablePosition, 2, 3, structureBoundingBoxIn);
|
|
}
|
|
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 1, 1, 0, structureBoundingBoxIn);
|
|
this.setBlockState(worldIn, Blocks.air.getState(), 1, 2, 0, structureBoundingBoxIn);
|
|
this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, Facing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
|
|
|
if (this.getBlockStateFromPos(worldIn, 1, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
|
{
|
|
this.setBlockState(worldIn, Blocks.cobblestone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.cobblestone_stairs, 3)), 1, 0, -1, structureBoundingBoxIn);
|
|
}
|
|
|
|
for (int i = 0; i < 5; ++i)
|
|
{
|
|
for (int j = 0; j < 4; ++j)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, i, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getState(), j, -1, i, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.spawnVillagers(worldIn, structureBoundingBoxIn, 1, 1, 2, 1);
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public static class Cage extends StructureVillage.Village
|
|
{
|
|
private boolean villagerSpawned;
|
|
|
|
public Cage()
|
|
{
|
|
}
|
|
|
|
public Cage(StructureVillage.Start start, int p_i45565_2_, Random rand, StructureBoundingBox p_i45565_4_, Facing facing)
|
|
{
|
|
super(start, p_i45565_2_);
|
|
this.coordBaseMode = facing;
|
|
this.boundingBox = p_i45565_4_;
|
|
}
|
|
|
|
protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.writeStructureToNBT(tagCompound);
|
|
tagCompound.setBoolean("VSpawn", this.villagerSpawned);
|
|
}
|
|
|
|
protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
|
{
|
|
super.readStructureFromNBT(tagCompound);
|
|
this.villagerSpawned = tagCompound.getBoolean("VSpawn");
|
|
}
|
|
|
|
public static StructureVillage.Cage func_175853_a(StructureVillage.Start start, List<StructureComponent> p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, Facing facing, int p_175853_7_)
|
|
{
|
|
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175853_3_, p_175853_4_, p_175853_5_, 0, 0, 0, 5, 6, 5, facing);
|
|
return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new StructureVillage.Cage(start, p_175853_7_, rand, structureboundingbox, facing) : null;
|
|
}
|
|
|
|
protected void spawnVillager(WorldServer worldIn, StructureBoundingBox p_74893_2_, int x, int y, int z)
|
|
{
|
|
if (!this.villagerSpawned && Config.mobs && Config.spawnCagedVillager)
|
|
{
|
|
int j = this.getXWithOffset(x, z);
|
|
int k = this.getYWithOffset(y);
|
|
int l = this.getZWithOffset(x, z);
|
|
|
|
if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.villagerSpawned = true;
|
|
EntityHuman entity = new EntityHuman(worldIn);
|
|
entity.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, worldIn.rand.floatv() * 360.0F, 0.0F);
|
|
entity.onInitialSpawn(null);
|
|
worldIn.spawnEntityInWorld(entity);
|
|
}
|
|
}
|
|
|
|
public boolean addComponentParts(WorldServer worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
|
{
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
|
|
|
if (this.field_143015_k < 0)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0);
|
|
}
|
|
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 4, 3, Blocks.air.getState(), Blocks.air.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 0, 4, Blocks.cobblestone.getState(), Blocks.cobblestone.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 4, 5, 4, Blocks.stone_slab.getState(), Blocks.stone_slab.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 4, 0, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 4, 0, 4, 4, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 0, 4, 4, 0, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 4, 4, 4, 4, Blocks.oak_log.getState(), Blocks.oak_log.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 3, 4, 0, Blocks.oak_fence.getState(), Blocks.oak_fence.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 4, 3, Blocks.oak_fence.getState(), Blocks.oak_fence.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 4, 3, Blocks.oak_fence.getState(), Blocks.oak_fence.getState(), false);
|
|
this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 3, 4, 4, Blocks.oak_fence.getState(), Blocks.oak_fence.getState(), false);
|
|
|
|
for (int i = 0; i < 5; ++i)
|
|
{
|
|
for (int j = 0; j < 5; ++j)
|
|
{
|
|
this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, i, structureBoundingBoxIn);
|
|
this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getState(), j, -1, i, structureBoundingBoxIn);
|
|
}
|
|
}
|
|
|
|
this.spawnVillager(worldIn, structureBoundingBoxIn, 2, 1, 2);
|
|
return true;
|
|
}
|
|
}
|
|
}
|