| 1 | package net.minecraft.world.gen.structure;
|
| 2 |
|
| 3 | import com.google.common.collect.Lists;
|
| 4 | import java.util.Iterator;
|
| 5 | import java.util.List;
|
| 6 | import java.util.Random;
|
| 7 | import net.minecraft.block.Block;
|
| 8 | import net.minecraft.block.BlockSandStone;
|
| 9 | import net.minecraft.block.BlockStairs;
|
| 10 | import net.minecraft.block.BlockTorch;
|
| 11 | import net.minecraft.block.material.Material;
|
| 12 | import net.minecraft.block.state.IBlockState;
|
| 13 | import net.minecraft.entity.IEntityLivingData;
|
| 14 | import net.minecraft.entity.passive.EntityVillager;
|
| 15 | import net.minecraft.init.Blocks;
|
| 16 | import net.minecraft.init.Items;
|
| 17 | import net.minecraft.item.EnumDyeColor;
|
| 18 | import net.minecraft.item.Item;
|
| 19 | import net.minecraft.nbt.NBTTagCompound;
|
| 20 | import net.minecraft.util.BlockPos;
|
| 21 | import net.minecraft.util.EnumFacing;
|
| 22 | import net.minecraft.util.MathHelper;
|
| 23 | import net.minecraft.util.WeightedRandomChestContent;
|
| 24 | import net.minecraft.world.World;
|
| 25 | import net.minecraft.world.biome.BiomeGenBase;
|
| 26 | import net.minecraft.world.biome.WorldChunkManager;
|
| 27 |
|
| 28 | @SuppressWarnings("incomplete-switch")
|
| 29 | public class StructureVillagePieces
|
| 30 | {
|
| 31 | public static void registerVillagePieces()
|
| 32 | {
|
| 33 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House1.class, "ViBH");
|
| 34 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field1.class, "ViDF");
|
| 35 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field2.class, "ViF");
|
| 36 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Torch.class, "ViL");
|
| 37 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Hall.class, "ViPH");
|
| 38 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House4Garden.class, "ViSH");
|
| 39 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.WoodHut.class, "ViSmH");
|
| 40 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Church.class, "ViST");
|
| 41 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House2.class, "ViS");
|
| 42 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Start.class, "ViStart");
|
| 43 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Path.class, "ViSR");
|
| 44 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House3.class, "ViTRH");
|
| 45 | MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Well.class, "ViW");
|
| 46 | }
|
| 47 |
|
| 48 | public static List<StructureVillagePieces.PieceWeight> getStructureVillageWeightedPieceList(Random random, int size)
|
| 49 | {
|
| 50 | List<StructureVillagePieces.PieceWeight> list = Lists.<StructureVillagePieces.PieceWeight>newArrayList();
|
| 51 | list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House4Garden.class, 4, MathHelper.getRandomIntegerInRange(random, 2 + size, 4 + size * 2)));
|
| 52 | list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Church.class, 20, MathHelper.getRandomIntegerInRange(random, 0 + size, 1 + size)));
|
| 53 | list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House1.class, 20, MathHelper.getRandomIntegerInRange(random, 0 + size, 2 + size)));
|
| 54 | list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.WoodHut.class, 3, MathHelper.getRandomIntegerInRange(random, 2 + size, 5 + size * 3)));
|
| 55 | list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Hall.class, 15, MathHelper.getRandomIntegerInRange(random, 0 + size, 2 + size)));
|
| 56 | list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field1.class, 3, MathHelper.getRandomIntegerInRange(random, 1 + size, 4 + size)));
|
| 57 | list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getRandomIntegerInRange(random, 2 + size, 4 + size * 2)));
|
| 58 | list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getRandomIntegerInRange(random, 0, 1 + size)));
|
| 59 | list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getRandomIntegerInRange(random, 0 + size, 3 + size * 2)));
|
| 60 | Iterator<StructureVillagePieces.PieceWeight> iterator = list.iterator();
|
| 61 |
|
| 62 | while (iterator.hasNext())
|
| 63 | {
|
| 64 | if (((StructureVillagePieces.PieceWeight)iterator.next()).villagePiecesLimit == 0)
|
| 65 | {
|
| 66 | iterator.remove();
|
| 67 | }
|
| 68 | }
|
| 69 |
|
| 70 | return list;
|
| 71 | }
|
| 72 |
|
| 73 | private static int func_75079_a(List<StructureVillagePieces.PieceWeight> p_75079_0_)
|
| 74 | {
|
| 75 | boolean flag = false;
|
| 76 | int i = 0;
|
| 77 |
|
| 78 | for (StructureVillagePieces.PieceWeight structurevillagepieces$pieceweight : p_75079_0_)
|
| 79 | {
|
| 80 | if (structurevillagepieces$pieceweight.villagePiecesLimit > 0 && structurevillagepieces$pieceweight.villagePiecesSpawned < structurevillagepieces$pieceweight.villagePiecesLimit)
|
| 81 | {
|
| 82 | flag = true;
|
| 83 | }
|
| 84 |
|
| 85 | i += structurevillagepieces$pieceweight.villagePieceWeight;
|
| 86 | }
|
| 87 |
|
| 88 | return flag ? i : -1;
|
| 89 | }
|
| 90 |
|
| 91 | private static StructureVillagePieces.Village func_176065_a(StructureVillagePieces.Start start, StructureVillagePieces.PieceWeight weight, List<StructureComponent> p_176065_2_, Random rand, int p_176065_4_, int p_176065_5_, int p_176065_6_, EnumFacing facing, int p_176065_8_)
|
| 92 | {
|
| 93 | Class <? extends StructureVillagePieces.Village > oclass = weight.villagePieceClass;
|
| 94 | StructureVillagePieces.Village structurevillagepieces$village = null;
|
| 95 |
|
| 96 | if (oclass == StructureVillagePieces.House4Garden.class)
|
| 97 | {
|
| 98 | structurevillagepieces$village = StructureVillagePieces.House4Garden.func_175858_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
| 99 | }
|
| 100 | else if (oclass == StructureVillagePieces.Church.class)
|
| 101 | {
|
| 102 | structurevillagepieces$village = StructureVillagePieces.Church.func_175854_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
| 103 | }
|
| 104 | else if (oclass == StructureVillagePieces.House1.class)
|
| 105 | {
|
| 106 | structurevillagepieces$village = StructureVillagePieces.House1.func_175850_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
| 107 | }
|
| 108 | else if (oclass == StructureVillagePieces.WoodHut.class)
|
| 109 | {
|
| 110 | structurevillagepieces$village = StructureVillagePieces.WoodHut.func_175853_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
| 111 | }
|
| 112 | else if (oclass == StructureVillagePieces.Hall.class)
|
| 113 | {
|
| 114 | structurevillagepieces$village = StructureVillagePieces.Hall.func_175857_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
| 115 | }
|
| 116 | else if (oclass == StructureVillagePieces.Field1.class)
|
| 117 | {
|
| 118 | structurevillagepieces$village = StructureVillagePieces.Field1.func_175851_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
| 119 | }
|
| 120 | else if (oclass == StructureVillagePieces.Field2.class)
|
| 121 | {
|
| 122 | structurevillagepieces$village = StructureVillagePieces.Field2.func_175852_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
| 123 | }
|
| 124 | else if (oclass == StructureVillagePieces.House2.class)
|
| 125 | {
|
| 126 | structurevillagepieces$village = StructureVillagePieces.House2.func_175855_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
| 127 | }
|
| 128 | else if (oclass == StructureVillagePieces.House3.class)
|
| 129 | {
|
| 130 | structurevillagepieces$village = StructureVillagePieces.House3.func_175849_a(start, p_176065_2_, rand, p_176065_4_, p_176065_5_, p_176065_6_, facing, p_176065_8_);
|
| 131 | }
|
| 132 |
|
| 133 | return structurevillagepieces$village;
|
| 134 | }
|
| 135 |
|
| 136 | private static StructureVillagePieces.Village func_176067_c(StructureVillagePieces.Start start, List<StructureComponent> p_176067_1_, Random rand, int p_176067_3_, int p_176067_4_, int p_176067_5_, EnumFacing facing, int p_176067_7_)
|
| 137 | {
|
| 138 | int i = func_75079_a(start.structureVillageWeightedPieceList);
|
| 139 |
|
| 140 | if (i <= 0)
|
| 141 | {
|
| 142 | return null;
|
| 143 | }
|
| 144 | else
|
| 145 | {
|
| 146 | int j = 0;
|
| 147 |
|
| 148 | while (j < 5)
|
| 149 | {
|
| 150 | ++j;
|
| 151 | int k = rand.nextInt(i);
|
| 152 |
|
| 153 | for (StructureVillagePieces.PieceWeight structurevillagepieces$pieceweight : start.structureVillageWeightedPieceList)
|
| 154 | {
|
| 155 | k -= structurevillagepieces$pieceweight.villagePieceWeight;
|
| 156 |
|
| 157 | if (k < 0)
|
| 158 | {
|
| 159 | if (!structurevillagepieces$pieceweight.canSpawnMoreVillagePiecesOfType(p_176067_7_) || structurevillagepieces$pieceweight == start.structVillagePieceWeight && start.structureVillageWeightedPieceList.size() > 1)
|
| 160 | {
|
| 161 | break;
|
| 162 | }
|
| 163 |
|
| 164 | StructureVillagePieces.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_);
|
| 165 |
|
| 166 | if (structurevillagepieces$village != null)
|
| 167 | {
|
| 168 | ++structurevillagepieces$pieceweight.villagePiecesSpawned;
|
| 169 | start.structVillagePieceWeight = structurevillagepieces$pieceweight;
|
| 170 |
|
| 171 | if (!structurevillagepieces$pieceweight.canSpawnMoreVillagePieces())
|
| 172 | {
|
| 173 | start.structureVillageWeightedPieceList.remove(structurevillagepieces$pieceweight);
|
| 174 | }
|
| 175 |
|
| 176 | return structurevillagepieces$village;
|
| 177 | }
|
| 178 | }
|
| 179 | }
|
| 180 | }
|
| 181 |
|
| 182 | StructureBoundingBox structureboundingbox = StructureVillagePieces.Torch.func_175856_a(start, p_176067_1_, rand, p_176067_3_, p_176067_4_, p_176067_5_, facing);
|
| 183 |
|
| 184 | if (structureboundingbox != null)
|
| 185 | {
|
| 186 | return new StructureVillagePieces.Torch(start, p_176067_7_, rand, structureboundingbox, facing);
|
| 187 | }
|
| 188 | else
|
| 189 | {
|
| 190 | return null;
|
| 191 | }
|
| 192 | }
|
| 193 | }
|
| 194 |
|
| 195 | private static StructureComponent func_176066_d(StructureVillagePieces.Start start, List<StructureComponent> p_176066_1_, Random rand, int p_176066_3_, int p_176066_4_, int p_176066_5_, EnumFacing facing, int p_176066_7_)
|
| 196 | {
|
| 197 | if (p_176066_7_ > 50)
|
| 198 | {
|
| 199 | return null;
|
| 200 | }
|
| 201 | else if (Math.abs(p_176066_3_ - start.getBoundingBox().minX) <= 112 && Math.abs(p_176066_5_ - start.getBoundingBox().minZ) <= 112)
|
| 202 | {
|
| 203 | StructureComponent structurecomponent = func_176067_c(start, p_176066_1_, rand, p_176066_3_, p_176066_4_, p_176066_5_, facing, p_176066_7_ + 1);
|
| 204 |
|
| 205 | if (structurecomponent != null)
|
| 206 | {
|
| 207 | int i = (structurecomponent.boundingBox.minX + structurecomponent.boundingBox.maxX) / 2;
|
| 208 | int j = (structurecomponent.boundingBox.minZ + structurecomponent.boundingBox.maxZ) / 2;
|
| 209 | int k = structurecomponent.boundingBox.maxX - structurecomponent.boundingBox.minX;
|
| 210 | int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ;
|
| 211 | int i1 = k > l ? k : l;
|
| 212 |
|
| 213 | if (start.getWorldChunkManager().areBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.villageSpawnBiomes))
|
| 214 | {
|
| 215 | p_176066_1_.add(structurecomponent);
|
| 216 | start.field_74932_i.add(structurecomponent);
|
| 217 | return structurecomponent;
|
| 218 | }
|
| 219 | }
|
| 220 |
|
| 221 | return null;
|
| 222 | }
|
| 223 | else
|
| 224 | {
|
| 225 | return null;
|
| 226 | }
|
| 227 | }
|
| 228 |
|
| 229 | private static StructureComponent func_176069_e(StructureVillagePieces.Start start, List<StructureComponent> p_176069_1_, Random rand, int p_176069_3_, int p_176069_4_, int p_176069_5_, EnumFacing facing, int p_176069_7_)
|
| 230 | {
|
| 231 | if (p_176069_7_ > 3 + start.terrainType)
|
| 232 | {
|
| 233 | return null;
|
| 234 | }
|
| 235 | else if (Math.abs(p_176069_3_ - start.getBoundingBox().minX) <= 112 && Math.abs(p_176069_5_ - start.getBoundingBox().minZ) <= 112)
|
| 236 | {
|
| 237 | StructureBoundingBox structureboundingbox = StructureVillagePieces.Path.func_175848_a(start, p_176069_1_, rand, p_176069_3_, p_176069_4_, p_176069_5_, facing);
|
| 238 |
|
| 239 | if (structureboundingbox != null && structureboundingbox.minY > 10)
|
| 240 | {
|
| 241 | StructureComponent structurecomponent = new StructureVillagePieces.Path(start, p_176069_7_, rand, structureboundingbox, facing);
|
| 242 | int i = (structurecomponent.boundingBox.minX + structurecomponent.boundingBox.maxX) / 2;
|
| 243 | int j = (structurecomponent.boundingBox.minZ + structurecomponent.boundingBox.maxZ) / 2;
|
| 244 | int k = structurecomponent.boundingBox.maxX - structurecomponent.boundingBox.minX;
|
| 245 | int l = structurecomponent.boundingBox.maxZ - structurecomponent.boundingBox.minZ;
|
| 246 | int i1 = k > l ? k : l;
|
| 247 |
|
| 248 | if (start.getWorldChunkManager().areBiomesViable(i, j, i1 / 2 + 4, MapGenVillage.villageSpawnBiomes))
|
| 249 | {
|
| 250 | p_176069_1_.add(structurecomponent);
|
| 251 | start.field_74930_j.add(structurecomponent);
|
| 252 | return structurecomponent;
|
| 253 | }
|
| 254 | }
|
| 255 |
|
| 256 | return null;
|
| 257 | }
|
| 258 | else
|
| 259 | {
|
| 260 | return null;
|
| 261 | }
|
| 262 | }
|
| 263 |
|
| 264 | public static class Church extends StructureVillagePieces.Village
|
| 265 | {
|
| 266 | public Church()
|
| 267 | {
|
| 268 | }
|
| 269 |
|
| 270 | public Church(StructureVillagePieces.Start start, int p_i45564_2_, Random rand, StructureBoundingBox p_i45564_4_, EnumFacing facing)
|
| 271 | {
|
| 272 | super(start, p_i45564_2_);
|
| 273 | this.coordBaseMode = facing;
|
| 274 | this.boundingBox = p_i45564_4_;
|
| 275 | }
|
| 276 |
|
| 277 | public static StructureVillagePieces.Church func_175854_a(StructureVillagePieces.Start start, List<StructureComponent> p_175854_1_, Random rand, int p_175854_3_, int p_175854_4_, int p_175854_5_, EnumFacing facing, int p_175854_7_)
|
| 278 | {
|
| 279 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175854_3_, p_175854_4_, p_175854_5_, 0, 0, 0, 5, 12, 9, facing);
|
| 280 | return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175854_1_, structureboundingbox) == null ? new StructureVillagePieces.Church(start, p_175854_7_, rand, structureboundingbox, facing) : null;
|
| 281 | }
|
| 282 |
|
| 283 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 284 | {
|
| 285 | if (this.field_143015_k < 0)
|
| 286 | {
|
| 287 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 288 |
|
| 289 | if (this.field_143015_k < 0)
|
| 290 | {
|
| 291 | return true;
|
| 292 | }
|
| 293 |
|
| 294 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 12 - 1, 0);
|
| 295 | }
|
| 296 |
|
| 297 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 3, 7, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 298 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 3, 9, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 299 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 3, 0, 8, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 300 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 3, 10, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 301 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 10, 3, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 302 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 10, 3, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 303 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 4, 0, 4, 7, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 304 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 4, 4, 4, 7, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 305 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 8, 3, 4, 8, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 306 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 4, 3, 10, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 307 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 5, 3, 5, 7, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 308 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 9, 0, 4, 9, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 309 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 4, 4, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 310 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 11, 2, structureBoundingBoxIn);
|
| 311 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 11, 2, structureBoundingBoxIn);
|
| 312 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 2, 11, 0, structureBoundingBoxIn);
|
| 313 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 2, 11, 4, structureBoundingBoxIn);
|
| 314 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 1, 1, 6, structureBoundingBoxIn);
|
| 315 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 1, 1, 7, structureBoundingBoxIn);
|
| 316 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 2, 1, 7, structureBoundingBoxIn);
|
| 317 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 3, 1, 6, structureBoundingBoxIn);
|
| 318 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 3, 1, 7, structureBoundingBoxIn);
|
| 319 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 1, 1, 5, structureBoundingBoxIn);
|
| 320 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 1, 6, structureBoundingBoxIn);
|
| 321 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 3, 1, 5, structureBoundingBoxIn);
|
| 322 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 1)), 1, 2, 7, structureBoundingBoxIn);
|
| 323 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 0)), 3, 2, 7, structureBoundingBoxIn);
|
| 324 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn);
|
| 325 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 3, 2, structureBoundingBoxIn);
|
| 326 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 2, 2, structureBoundingBoxIn);
|
| 327 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 3, 2, structureBoundingBoxIn);
|
| 328 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 6, 2, structureBoundingBoxIn);
|
| 329 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 7, 2, structureBoundingBoxIn);
|
| 330 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 6, 2, structureBoundingBoxIn);
|
| 331 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 7, 2, structureBoundingBoxIn);
|
| 332 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 6, 0, structureBoundingBoxIn);
|
| 333 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 7, 0, structureBoundingBoxIn);
|
| 334 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 6, 4, structureBoundingBoxIn);
|
| 335 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 7, 4, structureBoundingBoxIn);
|
| 336 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 3, 6, structureBoundingBoxIn);
|
| 337 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 3, 6, structureBoundingBoxIn);
|
| 338 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 3, 8, structureBoundingBoxIn);
|
| 339 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 2, 4, 7, structureBoundingBoxIn);
|
| 340 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), 1, 4, 6, structureBoundingBoxIn);
|
| 341 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), 3, 4, 6, structureBoundingBoxIn);
|
| 342 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 4, 5, structureBoundingBoxIn);
|
| 343 | int i = this.getMetadataWithOffset(Blocks.ladder, 4);
|
| 344 |
|
| 345 | for (int j = 1; j <= 9; ++j)
|
| 346 | {
|
| 347 | this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, j, 3, structureBoundingBoxIn);
|
| 348 | }
|
| 349 |
|
| 350 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 1, 0, structureBoundingBoxIn);
|
| 351 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 2, 0, structureBoundingBoxIn);
|
| 352 | this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 2, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
| 353 |
|
| 354 | if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
| 355 | {
|
| 356 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn);
|
| 357 | }
|
| 358 |
|
| 359 | for (int l = 0; l < 9; ++l)
|
| 360 | {
|
| 361 | for (int k = 0; k < 5; ++k)
|
| 362 | {
|
| 363 | this.clearCurrentPositionBlocksUpwards(worldIn, k, 12, l, structureBoundingBoxIn);
|
| 364 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), k, -1, l, structureBoundingBoxIn);
|
| 365 | }
|
| 366 | }
|
| 367 |
|
| 368 | this.spawnVillagers(worldIn, structureBoundingBoxIn, 2, 1, 2, 1);
|
| 369 | return true;
|
| 370 | }
|
| 371 |
|
| 372 | protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
| 373 | {
|
| 374 | return 2;
|
| 375 | }
|
| 376 | }
|
| 377 |
|
| 378 | public static class Field1 extends StructureVillagePieces.Village
|
| 379 | {
|
| 380 | private Block cropTypeA;
|
| 381 | private Block cropTypeB;
|
| 382 | private Block cropTypeC;
|
| 383 | private Block cropTypeD;
|
| 384 |
|
| 385 | public Field1()
|
| 386 | {
|
| 387 | }
|
| 388 |
|
| 389 | public Field1(StructureVillagePieces.Start start, int p_i45570_2_, Random rand, StructureBoundingBox p_i45570_4_, EnumFacing facing)
|
| 390 | {
|
| 391 | super(start, p_i45570_2_);
|
| 392 | this.coordBaseMode = facing;
|
| 393 | this.boundingBox = p_i45570_4_;
|
| 394 | this.cropTypeA = this.func_151559_a(rand);
|
| 395 | this.cropTypeB = this.func_151559_a(rand);
|
| 396 | this.cropTypeC = this.func_151559_a(rand);
|
| 397 | this.cropTypeD = this.func_151559_a(rand);
|
| 398 | }
|
| 399 |
|
| 400 | protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
| 401 | {
|
| 402 | super.writeStructureToNBT(tagCompound);
|
| 403 | tagCompound.setInteger("CA", Block.blockRegistry.getIDForObject(this.cropTypeA));
|
| 404 | tagCompound.setInteger("CB", Block.blockRegistry.getIDForObject(this.cropTypeB));
|
| 405 | tagCompound.setInteger("CC", Block.blockRegistry.getIDForObject(this.cropTypeC));
|
| 406 | tagCompound.setInteger("CD", Block.blockRegistry.getIDForObject(this.cropTypeD));
|
| 407 | }
|
| 408 |
|
| 409 | protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
| 410 | {
|
| 411 | super.readStructureFromNBT(tagCompound);
|
| 412 | this.cropTypeA = Block.getBlockById(tagCompound.getInteger("CA"));
|
| 413 | this.cropTypeB = Block.getBlockById(tagCompound.getInteger("CB"));
|
| 414 | this.cropTypeC = Block.getBlockById(tagCompound.getInteger("CC"));
|
| 415 | this.cropTypeD = Block.getBlockById(tagCompound.getInteger("CD"));
|
| 416 | }
|
| 417 |
|
| 418 | private Block func_151559_a(Random rand)
|
| 419 | {
|
| 420 | switch (rand.nextInt(5))
|
| 421 | {
|
| 422 | case 0:
|
| 423 | return Blocks.carrots;
|
| 424 |
|
| 425 | case 1:
|
| 426 | return Blocks.potatoes;
|
| 427 |
|
| 428 | default:
|
| 429 | return Blocks.wheat;
|
| 430 | }
|
| 431 | }
|
| 432 |
|
| 433 | public static StructureVillagePieces.Field1 func_175851_a(StructureVillagePieces.Start start, List<StructureComponent> p_175851_1_, Random rand, int p_175851_3_, int p_175851_4_, int p_175851_5_, EnumFacing facing, int p_175851_7_)
|
| 434 | {
|
| 435 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175851_3_, p_175851_4_, p_175851_5_, 0, 0, 0, 13, 4, 9, facing);
|
| 436 | return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175851_1_, structureboundingbox) == null ? new StructureVillagePieces.Field1(start, p_175851_7_, rand, structureboundingbox, facing) : null;
|
| 437 | }
|
| 438 |
|
| 439 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 440 | {
|
| 441 | if (this.field_143015_k < 0)
|
| 442 | {
|
| 443 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 444 |
|
| 445 | if (this.field_143015_k < 0)
|
| 446 | {
|
| 447 | return true;
|
| 448 | }
|
| 449 |
|
| 450 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
|
| 451 | }
|
| 452 |
|
| 453 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 12, 4, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 454 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false);
|
| 455 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 1, 5, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false);
|
| 456 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 0, 1, 8, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false);
|
| 457 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 10, 0, 1, 11, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false);
|
| 458 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 459 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 0, 6, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 460 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 12, 0, 0, 12, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 461 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 11, 0, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 462 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 8, 11, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 463 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 1, 3, 0, 7, Blocks.water.getDefaultState(), Blocks.water.getDefaultState(), false);
|
| 464 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 0, 1, 9, 0, 7, Blocks.water.getDefaultState(), Blocks.water.getDefaultState(), false);
|
| 465 |
|
| 466 | for (int i = 1; i <= 7; ++i)
|
| 467 | {
|
| 468 | this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 1, 1, i, structureBoundingBoxIn);
|
| 469 | this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 2, 1, i, structureBoundingBoxIn);
|
| 470 | this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 4, 1, i, structureBoundingBoxIn);
|
| 471 | this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 5, 1, i, structureBoundingBoxIn);
|
| 472 | this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 7, 1, i, structureBoundingBoxIn);
|
| 473 | this.setBlockState(worldIn, this.cropTypeC.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 8, 1, i, structureBoundingBoxIn);
|
| 474 | this.setBlockState(worldIn, this.cropTypeD.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 10, 1, i, structureBoundingBoxIn);
|
| 475 | this.setBlockState(worldIn, this.cropTypeD.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 11, 1, i, structureBoundingBoxIn);
|
| 476 | }
|
| 477 |
|
| 478 | for (int k = 0; k < 9; ++k)
|
| 479 | {
|
| 480 | for (int j = 0; j < 13; ++j)
|
| 481 | {
|
| 482 | this.clearCurrentPositionBlocksUpwards(worldIn, j, 4, k, structureBoundingBoxIn);
|
| 483 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.dirt.getDefaultState(), j, -1, k, structureBoundingBoxIn);
|
| 484 | }
|
| 485 | }
|
| 486 |
|
| 487 | return true;
|
| 488 | }
|
| 489 | }
|
| 490 |
|
| 491 | public static class Field2 extends StructureVillagePieces.Village
|
| 492 | {
|
| 493 | private Block cropTypeA;
|
| 494 | private Block cropTypeB;
|
| 495 |
|
| 496 | public Field2()
|
| 497 | {
|
| 498 | }
|
| 499 |
|
| 500 | public Field2(StructureVillagePieces.Start start, int p_i45569_2_, Random rand, StructureBoundingBox p_i45569_4_, EnumFacing facing)
|
| 501 | {
|
| 502 | super(start, p_i45569_2_);
|
| 503 | this.coordBaseMode = facing;
|
| 504 | this.boundingBox = p_i45569_4_;
|
| 505 | this.cropTypeA = this.func_151560_a(rand);
|
| 506 | this.cropTypeB = this.func_151560_a(rand);
|
| 507 | }
|
| 508 |
|
| 509 | protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
| 510 | {
|
| 511 | super.writeStructureToNBT(tagCompound);
|
| 512 | tagCompound.setInteger("CA", Block.blockRegistry.getIDForObject(this.cropTypeA));
|
| 513 | tagCompound.setInteger("CB", Block.blockRegistry.getIDForObject(this.cropTypeB));
|
| 514 | }
|
| 515 |
|
| 516 | protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
| 517 | {
|
| 518 | super.readStructureFromNBT(tagCompound);
|
| 519 | this.cropTypeA = Block.getBlockById(tagCompound.getInteger("CA"));
|
| 520 | this.cropTypeB = Block.getBlockById(tagCompound.getInteger("CB"));
|
| 521 | }
|
| 522 |
|
| 523 | private Block func_151560_a(Random rand)
|
| 524 | {
|
| 525 | switch (rand.nextInt(5))
|
| 526 | {
|
| 527 | case 0:
|
| 528 | return Blocks.carrots;
|
| 529 |
|
| 530 | case 1:
|
| 531 | return Blocks.potatoes;
|
| 532 |
|
| 533 | default:
|
| 534 | return Blocks.wheat;
|
| 535 | }
|
| 536 | }
|
| 537 |
|
| 538 | public static StructureVillagePieces.Field2 func_175852_a(StructureVillagePieces.Start start, List<StructureComponent> p_175852_1_, Random rand, int p_175852_3_, int p_175852_4_, int p_175852_5_, EnumFacing facing, int p_175852_7_)
|
| 539 | {
|
| 540 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175852_3_, p_175852_4_, p_175852_5_, 0, 0, 0, 7, 4, 9, facing);
|
| 541 | return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175852_1_, structureboundingbox) == null ? new StructureVillagePieces.Field2(start, p_175852_7_, rand, structureboundingbox, facing) : null;
|
| 542 | }
|
| 543 |
|
| 544 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 545 | {
|
| 546 | if (this.field_143015_k < 0)
|
| 547 | {
|
| 548 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 549 |
|
| 550 | if (this.field_143015_k < 0)
|
| 551 | {
|
| 552 | return true;
|
| 553 | }
|
| 554 |
|
| 555 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
|
| 556 | }
|
| 557 |
|
| 558 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 6, 4, 8, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 559 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false);
|
| 560 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 0, 1, 5, 0, 7, Blocks.farmland.getDefaultState(), Blocks.farmland.getDefaultState(), false);
|
| 561 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 562 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 0, 0, 6, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 563 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 5, 0, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 564 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 8, 5, 0, 8, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 565 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 1, 3, 0, 7, Blocks.water.getDefaultState(), Blocks.water.getDefaultState(), false);
|
| 566 |
|
| 567 | for (int i = 1; i <= 7; ++i)
|
| 568 | {
|
| 569 | this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 1, 1, i, structureBoundingBoxIn);
|
| 570 | this.setBlockState(worldIn, this.cropTypeA.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 2, 1, i, structureBoundingBoxIn);
|
| 571 | this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 4, 1, i, structureBoundingBoxIn);
|
| 572 | this.setBlockState(worldIn, this.cropTypeB.getStateFromMeta(MathHelper.getRandomIntegerInRange(randomIn, 2, 7)), 5, 1, i, structureBoundingBoxIn);
|
| 573 | }
|
| 574 |
|
| 575 | for (int k = 0; k < 9; ++k)
|
| 576 | {
|
| 577 | for (int j = 0; j < 7; ++j)
|
| 578 | {
|
| 579 | this.clearCurrentPositionBlocksUpwards(worldIn, j, 4, k, structureBoundingBoxIn);
|
| 580 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.dirt.getDefaultState(), j, -1, k, structureBoundingBoxIn);
|
| 581 | }
|
| 582 | }
|
| 583 |
|
| 584 | return true;
|
| 585 | }
|
| 586 | }
|
| 587 |
|
| 588 | public static class Hall extends StructureVillagePieces.Village
|
| 589 | {
|
| 590 | public Hall()
|
| 591 | {
|
| 592 | }
|
| 593 |
|
| 594 | public Hall(StructureVillagePieces.Start start, int p_i45567_2_, Random rand, StructureBoundingBox p_i45567_4_, EnumFacing facing)
|
| 595 | {
|
| 596 | super(start, p_i45567_2_);
|
| 597 | this.coordBaseMode = facing;
|
| 598 | this.boundingBox = p_i45567_4_;
|
| 599 | }
|
| 600 |
|
| 601 | public static StructureVillagePieces.Hall func_175857_a(StructureVillagePieces.Start start, List<StructureComponent> p_175857_1_, Random rand, int p_175857_3_, int p_175857_4_, int p_175857_5_, EnumFacing facing, int p_175857_7_)
|
| 602 | {
|
| 603 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175857_3_, p_175857_4_, p_175857_5_, 0, 0, 0, 9, 7, 11, facing);
|
| 604 | return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175857_1_, structureboundingbox) == null ? new StructureVillagePieces.Hall(start, p_175857_7_, rand, structureboundingbox, facing) : null;
|
| 605 | }
|
| 606 |
|
| 607 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 608 | {
|
| 609 | if (this.field_143015_k < 0)
|
| 610 | {
|
| 611 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 612 |
|
| 613 | if (this.field_143015_k < 0)
|
| 614 | {
|
| 615 | return true;
|
| 616 | }
|
| 617 |
|
| 618 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 7 - 1, 0);
|
| 619 | }
|
| 620 |
|
| 621 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 4, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 622 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 8, 4, 10, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 623 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 6, 8, 0, 10, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false);
|
| 624 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 6, 0, 6, structureBoundingBoxIn);
|
| 625 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 2, 1, 10, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false);
|
| 626 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 6, 8, 1, 10, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false);
|
| 627 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 10, 7, 1, 10, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false);
|
| 628 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 7, 0, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 629 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 3, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 630 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 0, 8, 3, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 631 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 7, 1, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 632 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 5, 7, 1, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 633 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 3, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 634 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 7, 3, 5, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 635 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 1, 8, 4, 1, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 636 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 4, 8, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 637 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 2, 8, 5, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 638 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 0, 4, 2, structureBoundingBoxIn);
|
| 639 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 0, 4, 3, structureBoundingBoxIn);
|
| 640 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 2, structureBoundingBoxIn);
|
| 641 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 3, structureBoundingBoxIn);
|
| 642 | int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3);
|
| 643 | int j = this.getMetadataWithOffset(Blocks.oak_stairs, 2);
|
| 644 |
|
| 645 | for (int k = -1; k <= 2; ++k)
|
| 646 | {
|
| 647 | for (int l = 0; l <= 8; ++l)
|
| 648 | {
|
| 649 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i), l, 4 + k, k, structureBoundingBoxIn);
|
| 650 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j), l, 4 + k, 5 - k, structureBoundingBoxIn);
|
| 651 | }
|
| 652 | }
|
| 653 |
|
| 654 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 2, 1, structureBoundingBoxIn);
|
| 655 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 2, 4, structureBoundingBoxIn);
|
| 656 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 1, structureBoundingBoxIn);
|
| 657 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 4, structureBoundingBoxIn);
|
| 658 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn);
|
| 659 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 3, structureBoundingBoxIn);
|
| 660 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 2, structureBoundingBoxIn);
|
| 661 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 3, structureBoundingBoxIn);
|
| 662 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 5, structureBoundingBoxIn);
|
| 663 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 3, 2, 5, structureBoundingBoxIn);
|
| 664 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 2, 0, structureBoundingBoxIn);
|
| 665 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 6, 2, 5, structureBoundingBoxIn);
|
| 666 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 2, 1, 3, structureBoundingBoxIn);
|
| 667 | this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), 2, 2, 3, structureBoundingBoxIn);
|
| 668 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 1, 4, structureBoundingBoxIn);
|
| 669 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 3)), 2, 1, 4, structureBoundingBoxIn);
|
| 670 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 1)), 1, 1, 3, structureBoundingBoxIn);
|
| 671 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 0, 1, 7, 0, 3, Blocks.double_stone_slab.getDefaultState(), Blocks.double_stone_slab.getDefaultState(), false);
|
| 672 | this.setBlockState(worldIn, Blocks.double_stone_slab.getDefaultState(), 6, 1, 1, structureBoundingBoxIn);
|
| 673 | this.setBlockState(worldIn, Blocks.double_stone_slab.getDefaultState(), 6, 1, 2, structureBoundingBoxIn);
|
| 674 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 1, 0, structureBoundingBoxIn);
|
| 675 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 2, 0, structureBoundingBoxIn);
|
| 676 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 3, 1, structureBoundingBoxIn);
|
| 677 | this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 2, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
| 678 |
|
| 679 | if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
| 680 | {
|
| 681 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn);
|
| 682 | }
|
| 683 |
|
| 684 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 6, 1, 5, structureBoundingBoxIn);
|
| 685 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 6, 2, 5, structureBoundingBoxIn);
|
| 686 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 6, 3, 4, structureBoundingBoxIn);
|
| 687 | this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 6, 1, 5, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
| 688 |
|
| 689 | for (int i1 = 0; i1 < 5; ++i1)
|
| 690 | {
|
| 691 | for (int j1 = 0; j1 < 9; ++j1)
|
| 692 | {
|
| 693 | this.clearCurrentPositionBlocksUpwards(worldIn, j1, 7, i1, structureBoundingBoxIn);
|
| 694 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j1, -1, i1, structureBoundingBoxIn);
|
| 695 | }
|
| 696 | }
|
| 697 |
|
| 698 | this.spawnVillagers(worldIn, structureBoundingBoxIn, 4, 1, 2, 2);
|
| 699 | return true;
|
| 700 | }
|
| 701 |
|
| 702 | protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
| 703 | {
|
| 704 | return p_180779_1_ == 0 ? 4 : super.func_180779_c(p_180779_1_, p_180779_2_);
|
| 705 | }
|
| 706 | }
|
| 707 |
|
| 708 | public static class House1 extends StructureVillagePieces.Village
|
| 709 | {
|
| 710 | public House1()
|
| 711 | {
|
| 712 | }
|
| 713 |
|
| 714 | public House1(StructureVillagePieces.Start start, int p_i45571_2_, Random rand, StructureBoundingBox p_i45571_4_, EnumFacing facing)
|
| 715 | {
|
| 716 | super(start, p_i45571_2_);
|
| 717 | this.coordBaseMode = facing;
|
| 718 | this.boundingBox = p_i45571_4_;
|
| 719 | }
|
| 720 |
|
| 721 | public static StructureVillagePieces.House1 func_175850_a(StructureVillagePieces.Start start, List<StructureComponent> p_175850_1_, Random rand, int p_175850_3_, int p_175850_4_, int p_175850_5_, EnumFacing facing, int p_175850_7_)
|
| 722 | {
|
| 723 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175850_3_, p_175850_4_, p_175850_5_, 0, 0, 0, 9, 9, 6, facing);
|
| 724 | return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175850_1_, structureboundingbox) == null ? new StructureVillagePieces.House1(start, p_175850_7_, rand, structureboundingbox, facing) : null;
|
| 725 | }
|
| 726 |
|
| 727 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 728 | {
|
| 729 | if (this.field_143015_k < 0)
|
| 730 | {
|
| 731 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 732 |
|
| 733 | if (this.field_143015_k < 0)
|
| 734 | {
|
| 735 | return true;
|
| 736 | }
|
| 737 |
|
| 738 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 9 - 1, 0);
|
| 739 | }
|
| 740 |
|
| 741 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 742 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 8, 0, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 743 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 8, 5, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 744 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 6, 1, 8, 6, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 745 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 7, 2, 8, 7, 3, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 746 | int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3);
|
| 747 | int j = this.getMetadataWithOffset(Blocks.oak_stairs, 2);
|
| 748 |
|
| 749 | for (int k = -1; k <= 2; ++k)
|
| 750 | {
|
| 751 | for (int l = 0; l <= 8; ++l)
|
| 752 | {
|
| 753 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i), l, 6 + k, k, structureBoundingBoxIn);
|
| 754 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j), l, 6 + k, 5 - k, structureBoundingBoxIn);
|
| 755 | }
|
| 756 | }
|
| 757 |
|
| 758 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 1, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 759 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 5, 8, 1, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 760 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 1, 0, 8, 1, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 761 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 0, 7, 1, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 762 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 0, 0, 4, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 763 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 5, 0, 4, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 764 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 2, 5, 8, 4, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 765 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 2, 0, 8, 4, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 766 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 2, 1, 0, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 767 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 7, 4, 5, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 768 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 2, 1, 8, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 769 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 4, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 770 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 2, 0, structureBoundingBoxIn);
|
| 771 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 2, 0, structureBoundingBoxIn);
|
| 772 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 6, 2, 0, structureBoundingBoxIn);
|
| 773 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 3, 0, structureBoundingBoxIn);
|
| 774 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 3, 0, structureBoundingBoxIn);
|
| 775 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 6, 3, 0, structureBoundingBoxIn);
|
| 776 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn);
|
| 777 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 3, structureBoundingBoxIn);
|
| 778 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 3, 2, structureBoundingBoxIn);
|
| 779 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 3, 3, structureBoundingBoxIn);
|
| 780 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 2, structureBoundingBoxIn);
|
| 781 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 3, structureBoundingBoxIn);
|
| 782 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 3, 2, structureBoundingBoxIn);
|
| 783 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 3, 3, structureBoundingBoxIn);
|
| 784 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 5, structureBoundingBoxIn);
|
| 785 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 3, 2, 5, structureBoundingBoxIn);
|
| 786 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 2, 5, structureBoundingBoxIn);
|
| 787 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 6, 2, 5, structureBoundingBoxIn);
|
| 788 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 7, 4, 1, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 789 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 4, 7, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 790 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 3, 4, 7, 3, 4, Blocks.bookshelf.getDefaultState(), Blocks.bookshelf.getDefaultState(), false);
|
| 791 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 7, 1, 4, structureBoundingBoxIn);
|
| 792 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 0)), 7, 1, 3, structureBoundingBoxIn);
|
| 793 | int j1 = this.getMetadataWithOffset(Blocks.oak_stairs, 3);
|
| 794 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 6, 1, 4, structureBoundingBoxIn);
|
| 795 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 5, 1, 4, structureBoundingBoxIn);
|
| 796 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 4, 1, 4, structureBoundingBoxIn);
|
| 797 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j1), 3, 1, 4, structureBoundingBoxIn);
|
| 798 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 6, 1, 3, structureBoundingBoxIn);
|
| 799 | this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), 6, 2, 3, structureBoundingBoxIn);
|
| 800 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 1, 3, structureBoundingBoxIn);
|
| 801 | this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), 4, 2, 3, structureBoundingBoxIn);
|
| 802 | this.setBlockState(worldIn, Blocks.crafting_table.getDefaultState(), 7, 1, 1, structureBoundingBoxIn);
|
| 803 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
|
| 804 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
|
| 805 | this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
| 806 |
|
| 807 | if (this.getBlockStateFromPos(worldIn, 1, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
| 808 | {
|
| 809 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 1, 0, -1, structureBoundingBoxIn);
|
| 810 | }
|
| 811 |
|
| 812 | for (int k1 = 0; k1 < 6; ++k1)
|
| 813 | {
|
| 814 | for (int i1 = 0; i1 < 9; ++i1)
|
| 815 | {
|
| 816 | this.clearCurrentPositionBlocksUpwards(worldIn, i1, 9, k1, structureBoundingBoxIn);
|
| 817 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), i1, -1, k1, structureBoundingBoxIn);
|
| 818 | }
|
| 819 | }
|
| 820 |
|
| 821 | this.spawnVillagers(worldIn, structureBoundingBoxIn, 2, 1, 2, 1);
|
| 822 | return true;
|
| 823 | }
|
| 824 |
|
| 825 | protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
| 826 | {
|
| 827 | return 1;
|
| 828 | }
|
| 829 | }
|
| 830 |
|
| 831 | public static class House2 extends StructureVillagePieces.Village
|
| 832 | {
|
| 833 | private static final List<WeightedRandomChestContent> villageBlacksmithChestContents = Lists.newArrayList(new WeightedRandomChestContent[] {new WeightedRandomChestContent(Items.diamond, 0, 1, 3, 3), new WeightedRandomChestContent(Items.iron_ingot, 0, 1, 5, 10), new WeightedRandomChestContent(Items.gold_ingot, 0, 1, 3, 5), new WeightedRandomChestContent(Items.bread, 0, 1, 3, 15), new WeightedRandomChestContent(Items.apple, 0, 1, 3, 15), new WeightedRandomChestContent(Items.iron_pickaxe, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_sword, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_chestplate, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_helmet, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_leggings, 0, 1, 1, 5), new WeightedRandomChestContent(Items.iron_boots, 0, 1, 1, 5), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.obsidian), 0, 3, 7, 5), new WeightedRandomChestContent(Item.getItemFromBlock(Blocks.sapling), 0, 3, 7, 5), new WeightedRandomChestContent(Items.saddle, 0, 1, 1, 3), new WeightedRandomChestContent(Items.iron_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.golden_horse_armor, 0, 1, 1, 1), new WeightedRandomChestContent(Items.diamond_horse_armor, 0, 1, 1, 1)});
|
| 834 | private boolean hasMadeChest;
|
| 835 |
|
| 836 | public House2()
|
| 837 | {
|
| 838 | }
|
| 839 |
|
| 840 | public House2(StructureVillagePieces.Start start, int p_i45563_2_, Random rand, StructureBoundingBox p_i45563_4_, EnumFacing facing)
|
| 841 | {
|
| 842 | super(start, p_i45563_2_);
|
| 843 | this.coordBaseMode = facing;
|
| 844 | this.boundingBox = p_i45563_4_;
|
| 845 | }
|
| 846 |
|
| 847 | public static StructureVillagePieces.House2 func_175855_a(StructureVillagePieces.Start start, List<StructureComponent> p_175855_1_, Random rand, int p_175855_3_, int p_175855_4_, int p_175855_5_, EnumFacing facing, int p_175855_7_)
|
| 848 | {
|
| 849 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175855_3_, p_175855_4_, p_175855_5_, 0, 0, 0, 10, 6, 7, facing);
|
| 850 | return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175855_1_, structureboundingbox) == null ? new StructureVillagePieces.House2(start, p_175855_7_, rand, structureboundingbox, facing) : null;
|
| 851 | }
|
| 852 |
|
| 853 | protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
| 854 | {
|
| 855 | super.writeStructureToNBT(tagCompound);
|
| 856 | tagCompound.setBoolean("Chest", this.hasMadeChest);
|
| 857 | }
|
| 858 |
|
| 859 | protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
| 860 | {
|
| 861 | super.readStructureFromNBT(tagCompound);
|
| 862 | this.hasMadeChest = tagCompound.getBoolean("Chest");
|
| 863 | }
|
| 864 |
|
| 865 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 866 | {
|
| 867 | if (this.field_143015_k < 0)
|
| 868 | {
|
| 869 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 870 |
|
| 871 | if (this.field_143015_k < 0)
|
| 872 | {
|
| 873 | return true;
|
| 874 | }
|
| 875 |
|
| 876 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0);
|
| 877 | }
|
| 878 |
|
| 879 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 9, 4, 6, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 880 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 9, 0, 6, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 881 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 9, 4, 6, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 882 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 0, 9, 5, 6, Blocks.stone_slab.getDefaultState(), Blocks.stone_slab.getDefaultState(), false);
|
| 883 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 8, 5, 5, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 884 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 885 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 4, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 886 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 3, 4, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 887 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 6, 0, 4, 6, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 888 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 3, 3, 1, structureBoundingBoxIn);
|
| 889 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 2, 3, 3, 2, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 890 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 3, 5, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 891 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 5, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 892 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 6, 5, 3, 6, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 893 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 1, 0, 5, 3, 0, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false);
|
| 894 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 9, 1, 0, 9, 3, 0, Blocks.oak_fence.getDefaultState(), Blocks.oak_fence.getDefaultState(), false);
|
| 895 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 1, 4, 9, 4, 6, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 896 | this.setBlockState(worldIn, Blocks.flowing_lava.getDefaultState(), 7, 1, 5, structureBoundingBoxIn);
|
| 897 | this.setBlockState(worldIn, Blocks.flowing_lava.getDefaultState(), 8, 1, 5, structureBoundingBoxIn);
|
| 898 | this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), 9, 2, 5, structureBoundingBoxIn);
|
| 899 | this.setBlockState(worldIn, Blocks.iron_bars.getDefaultState(), 9, 2, 4, structureBoundingBoxIn);
|
| 900 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 2, 4, 8, 2, 5, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 901 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 6, 1, 3, structureBoundingBoxIn);
|
| 902 | this.setBlockState(worldIn, Blocks.furnace.getDefaultState(), 6, 2, 3, structureBoundingBoxIn);
|
| 903 | this.setBlockState(worldIn, Blocks.furnace.getDefaultState(), 6, 3, 3, structureBoundingBoxIn);
|
| 904 | this.setBlockState(worldIn, Blocks.double_stone_slab.getDefaultState(), 8, 1, 1, structureBoundingBoxIn);
|
| 905 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn);
|
| 906 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 4, structureBoundingBoxIn);
|
| 907 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 6, structureBoundingBoxIn);
|
| 908 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 2, 6, structureBoundingBoxIn);
|
| 909 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 2, 1, 4, structureBoundingBoxIn);
|
| 910 | this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), 2, 2, 4, structureBoundingBoxIn);
|
| 911 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 1, 5, structureBoundingBoxIn);
|
| 912 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 3)), 2, 1, 5, structureBoundingBoxIn);
|
| 913 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.oak_stairs, 1)), 1, 1, 4, structureBoundingBoxIn);
|
| 914 |
|
| 915 | if (!this.hasMadeChest && structureBoundingBoxIn.isVecInside(new BlockPos(this.getXWithOffset(5, 5), this.getYWithOffset(1), this.getZWithOffset(5, 5))))
|
| 916 | {
|
| 917 | this.hasMadeChest = true;
|
| 918 | this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 5, 1, 5, villageBlacksmithChestContents, 3 + randomIn.nextInt(6));
|
| 919 | }
|
| 920 |
|
| 921 | for (int i = 6; i <= 8; ++i)
|
| 922 | {
|
| 923 | if (this.getBlockStateFromPos(worldIn, i, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, i, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
| 924 | {
|
| 925 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), i, 0, -1, structureBoundingBoxIn);
|
| 926 | }
|
| 927 | }
|
| 928 |
|
| 929 | for (int k = 0; k < 7; ++k)
|
| 930 | {
|
| 931 | for (int j = 0; j < 10; ++j)
|
| 932 | {
|
| 933 | this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, k, structureBoundingBoxIn);
|
| 934 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j, -1, k, structureBoundingBoxIn);
|
| 935 | }
|
| 936 | }
|
| 937 |
|
| 938 | this.spawnVillagers(worldIn, structureBoundingBoxIn, 7, 1, 1, 1);
|
| 939 | return true;
|
| 940 | }
|
| 941 |
|
| 942 | protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
| 943 | {
|
| 944 | return 3;
|
| 945 | }
|
| 946 | }
|
| 947 |
|
| 948 | public static class House3 extends StructureVillagePieces.Village
|
| 949 | {
|
| 950 | public House3()
|
| 951 | {
|
| 952 | }
|
| 953 |
|
| 954 | public House3(StructureVillagePieces.Start start, int p_i45561_2_, Random rand, StructureBoundingBox p_i45561_4_, EnumFacing facing)
|
| 955 | {
|
| 956 | super(start, p_i45561_2_);
|
| 957 | this.coordBaseMode = facing;
|
| 958 | this.boundingBox = p_i45561_4_;
|
| 959 | }
|
| 960 |
|
| 961 | public static StructureVillagePieces.House3 func_175849_a(StructureVillagePieces.Start start, List<StructureComponent> p_175849_1_, Random rand, int p_175849_3_, int p_175849_4_, int p_175849_5_, EnumFacing facing, int p_175849_7_)
|
| 962 | {
|
| 963 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175849_3_, p_175849_4_, p_175849_5_, 0, 0, 0, 9, 7, 12, facing);
|
| 964 | return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175849_1_, structureboundingbox) == null ? new StructureVillagePieces.House3(start, p_175849_7_, rand, structureboundingbox, facing) : null;
|
| 965 | }
|
| 966 |
|
| 967 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 968 | {
|
| 969 | if (this.field_143015_k < 0)
|
| 970 | {
|
| 971 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 972 |
|
| 973 | if (this.field_143015_k < 0)
|
| 974 | {
|
| 975 | return true;
|
| 976 | }
|
| 977 |
|
| 978 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 7 - 1, 0);
|
| 979 | }
|
| 980 |
|
| 981 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 7, 4, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 982 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 1, 6, 8, 4, 10, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 983 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 5, 8, 0, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 984 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 7, 0, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 985 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 0, 3, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 986 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 8, 0, 0, 8, 3, 10, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 987 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 0, 7, 2, 0, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 988 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 5, 2, 1, 5, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 989 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 0, 6, 2, 3, 10, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 990 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 0, 10, 7, 3, 10, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 991 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 0, 7, 3, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 992 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 2, 5, 2, 3, 5, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 993 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 1, 8, 4, 1, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 994 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 4, 3, 4, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 995 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 5, 2, 8, 5, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 996 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 0, 4, 2, structureBoundingBoxIn);
|
| 997 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 0, 4, 3, structureBoundingBoxIn);
|
| 998 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 2, structureBoundingBoxIn);
|
| 999 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 3, structureBoundingBoxIn);
|
| 1000 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 4, 4, structureBoundingBoxIn);
|
| 1001 | int i = this.getMetadataWithOffset(Blocks.oak_stairs, 3);
|
| 1002 | int j = this.getMetadataWithOffset(Blocks.oak_stairs, 2);
|
| 1003 |
|
| 1004 | for (int k = -1; k <= 2; ++k)
|
| 1005 | {
|
| 1006 | for (int l = 0; l <= 8; ++l)
|
| 1007 | {
|
| 1008 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i), l, 4 + k, k, structureBoundingBoxIn);
|
| 1009 |
|
| 1010 | if ((k > -1 || l <= 1) && (k > 0 || l <= 3) && (k > 1 || l <= 4 || l >= 6))
|
| 1011 | {
|
| 1012 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(j), l, 4 + k, 5 - k, structureBoundingBoxIn);
|
| 1013 | }
|
| 1014 | }
|
| 1015 | }
|
| 1016 |
|
| 1017 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 4, 5, 3, 4, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1018 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 7, 4, 2, 7, 4, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1019 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 5, 4, 4, 5, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1020 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 6, 5, 4, 6, 5, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1021 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 5, 6, 3, 5, 6, 10, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1022 | int k1 = this.getMetadataWithOffset(Blocks.oak_stairs, 0);
|
| 1023 |
|
| 1024 | for (int l1 = 4; l1 >= 1; --l1)
|
| 1025 | {
|
| 1026 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), l1, 2 + l1, 7 - l1, structureBoundingBoxIn);
|
| 1027 |
|
| 1028 | for (int i1 = 8 - l1; i1 <= 10; ++i1)
|
| 1029 | {
|
| 1030 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(k1), l1, 2 + l1, i1, structureBoundingBoxIn);
|
| 1031 | }
|
| 1032 | }
|
| 1033 |
|
| 1034 | int i2 = this.getMetadataWithOffset(Blocks.oak_stairs, 1);
|
| 1035 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 6, 6, 3, structureBoundingBoxIn);
|
| 1036 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 7, 5, 4, structureBoundingBoxIn);
|
| 1037 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i2), 6, 6, 4, structureBoundingBoxIn);
|
| 1038 |
|
| 1039 | for (int j2 = 6; j2 <= 8; ++j2)
|
| 1040 | {
|
| 1041 | for (int j1 = 5; j1 <= 10; ++j1)
|
| 1042 | {
|
| 1043 | this.setBlockState(worldIn, Blocks.oak_stairs.getStateFromMeta(i2), j2, 12 - j2, j1, structureBoundingBoxIn);
|
| 1044 | }
|
| 1045 | }
|
| 1046 |
|
| 1047 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 2, 1, structureBoundingBoxIn);
|
| 1048 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 2, 4, structureBoundingBoxIn);
|
| 1049 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn);
|
| 1050 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 3, structureBoundingBoxIn);
|
| 1051 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 4, 2, 0, structureBoundingBoxIn);
|
| 1052 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 2, 0, structureBoundingBoxIn);
|
| 1053 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 6, 2, 0, structureBoundingBoxIn);
|
| 1054 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 1, structureBoundingBoxIn);
|
| 1055 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 2, structureBoundingBoxIn);
|
| 1056 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 3, structureBoundingBoxIn);
|
| 1057 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 4, structureBoundingBoxIn);
|
| 1058 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 8, 2, 5, structureBoundingBoxIn);
|
| 1059 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 6, structureBoundingBoxIn);
|
| 1060 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 7, structureBoundingBoxIn);
|
| 1061 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 8, 2, 8, structureBoundingBoxIn);
|
| 1062 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 8, 2, 9, structureBoundingBoxIn);
|
| 1063 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 2, 2, 6, structureBoundingBoxIn);
|
| 1064 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 7, structureBoundingBoxIn);
|
| 1065 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 8, structureBoundingBoxIn);
|
| 1066 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 2, 2, 9, structureBoundingBoxIn);
|
| 1067 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 4, 4, 10, structureBoundingBoxIn);
|
| 1068 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 5, 4, 10, structureBoundingBoxIn);
|
| 1069 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 6, 4, 10, structureBoundingBoxIn);
|
| 1070 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 5, 5, 10, structureBoundingBoxIn);
|
| 1071 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 1, 0, structureBoundingBoxIn);
|
| 1072 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 2, 0, structureBoundingBoxIn);
|
| 1073 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 3, 1, structureBoundingBoxIn);
|
| 1074 | this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 2, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
| 1075 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, -1, 3, 2, -1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 1076 |
|
| 1077 | if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
| 1078 | {
|
| 1079 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn);
|
| 1080 | }
|
| 1081 |
|
| 1082 | for (int k2 = 0; k2 < 5; ++k2)
|
| 1083 | {
|
| 1084 | for (int i3 = 0; i3 < 9; ++i3)
|
| 1085 | {
|
| 1086 | this.clearCurrentPositionBlocksUpwards(worldIn, i3, 7, k2, structureBoundingBoxIn);
|
| 1087 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), i3, -1, k2, structureBoundingBoxIn);
|
| 1088 | }
|
| 1089 | }
|
| 1090 |
|
| 1091 | for (int l2 = 5; l2 < 11; ++l2)
|
| 1092 | {
|
| 1093 | for (int j3 = 2; j3 < 9; ++j3)
|
| 1094 | {
|
| 1095 | this.clearCurrentPositionBlocksUpwards(worldIn, j3, 7, l2, structureBoundingBoxIn);
|
| 1096 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j3, -1, l2, structureBoundingBoxIn);
|
| 1097 | }
|
| 1098 | }
|
| 1099 |
|
| 1100 | this.spawnVillagers(worldIn, structureBoundingBoxIn, 4, 1, 2, 2);
|
| 1101 | return true;
|
| 1102 | }
|
| 1103 | }
|
| 1104 |
|
| 1105 | public static class House4Garden extends StructureVillagePieces.Village
|
| 1106 | {
|
| 1107 | private boolean isRoofAccessible;
|
| 1108 |
|
| 1109 | public House4Garden()
|
| 1110 | {
|
| 1111 | }
|
| 1112 |
|
| 1113 | public House4Garden(StructureVillagePieces.Start start, int p_i45566_2_, Random rand, StructureBoundingBox p_i45566_4_, EnumFacing facing)
|
| 1114 | {
|
| 1115 | super(start, p_i45566_2_);
|
| 1116 | this.coordBaseMode = facing;
|
| 1117 | this.boundingBox = p_i45566_4_;
|
| 1118 | this.isRoofAccessible = rand.nextBoolean();
|
| 1119 | }
|
| 1120 |
|
| 1121 | protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
| 1122 | {
|
| 1123 | super.writeStructureToNBT(tagCompound);
|
| 1124 | tagCompound.setBoolean("Terrace", this.isRoofAccessible);
|
| 1125 | }
|
| 1126 |
|
| 1127 | protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
| 1128 | {
|
| 1129 | super.readStructureFromNBT(tagCompound);
|
| 1130 | this.isRoofAccessible = tagCompound.getBoolean("Terrace");
|
| 1131 | }
|
| 1132 |
|
| 1133 | public static StructureVillagePieces.House4Garden func_175858_a(StructureVillagePieces.Start start, List<StructureComponent> p_175858_1_, Random rand, int p_175858_3_, int p_175858_4_, int p_175858_5_, EnumFacing facing, int p_175858_7_)
|
| 1134 | {
|
| 1135 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175858_3_, p_175858_4_, p_175858_5_, 0, 0, 0, 5, 6, 5, facing);
|
| 1136 | return StructureComponent.findIntersecting(p_175858_1_, structureboundingbox) != null ? null : new StructureVillagePieces.House4Garden(start, p_175858_7_, rand, structureboundingbox, facing);
|
| 1137 | }
|
| 1138 |
|
| 1139 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 1140 | {
|
| 1141 | if (this.field_143015_k < 0)
|
| 1142 | {
|
| 1143 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 1144 |
|
| 1145 | if (this.field_143015_k < 0)
|
| 1146 | {
|
| 1147 | return true;
|
| 1148 | }
|
| 1149 |
|
| 1150 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0);
|
| 1151 | }
|
| 1152 |
|
| 1153 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 4, 0, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 1154 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 4, 0, 4, 4, 4, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 1155 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 3, 4, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1156 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 1, 0, structureBoundingBoxIn);
|
| 1157 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 2, 0, structureBoundingBoxIn);
|
| 1158 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 3, 0, structureBoundingBoxIn);
|
| 1159 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 1, 0, structureBoundingBoxIn);
|
| 1160 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 2, 0, structureBoundingBoxIn);
|
| 1161 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 3, 0, structureBoundingBoxIn);
|
| 1162 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 1, 4, structureBoundingBoxIn);
|
| 1163 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 2, 4, structureBoundingBoxIn);
|
| 1164 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 0, 3, 4, structureBoundingBoxIn);
|
| 1165 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 1, 4, structureBoundingBoxIn);
|
| 1166 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 2, 4, structureBoundingBoxIn);
|
| 1167 | this.setBlockState(worldIn, Blocks.cobblestone.getDefaultState(), 4, 3, 4, structureBoundingBoxIn);
|
| 1168 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1169 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 4, 1, 1, 4, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1170 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 3, 3, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1171 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn);
|
| 1172 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 2, 2, 4, structureBoundingBoxIn);
|
| 1173 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 4, 2, 2, structureBoundingBoxIn);
|
| 1174 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
|
| 1175 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
|
| 1176 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 1, 3, 0, structureBoundingBoxIn);
|
| 1177 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 2, 3, 0, structureBoundingBoxIn);
|
| 1178 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 3, 3, 0, structureBoundingBoxIn);
|
| 1179 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 3, 2, 0, structureBoundingBoxIn);
|
| 1180 | this.setBlockState(worldIn, Blocks.planks.getDefaultState(), 3, 1, 0, structureBoundingBoxIn);
|
| 1181 |
|
| 1182 | if (this.getBlockStateFromPos(worldIn, 2, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 2, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
| 1183 | {
|
| 1184 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 2, 0, -1, structureBoundingBoxIn);
|
| 1185 | }
|
| 1186 |
|
| 1187 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 3, 3, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 1188 |
|
| 1189 | if (this.isRoofAccessible)
|
| 1190 | {
|
| 1191 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 0, structureBoundingBoxIn);
|
| 1192 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 5, 0, structureBoundingBoxIn);
|
| 1193 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 2, 5, 0, structureBoundingBoxIn);
|
| 1194 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 3, 5, 0, structureBoundingBoxIn);
|
| 1195 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 0, structureBoundingBoxIn);
|
| 1196 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 4, structureBoundingBoxIn);
|
| 1197 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 5, 4, structureBoundingBoxIn);
|
| 1198 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 2, 5, 4, structureBoundingBoxIn);
|
| 1199 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 3, 5, 4, structureBoundingBoxIn);
|
| 1200 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 4, structureBoundingBoxIn);
|
| 1201 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 1, structureBoundingBoxIn);
|
| 1202 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 2, structureBoundingBoxIn);
|
| 1203 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 5, 3, structureBoundingBoxIn);
|
| 1204 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 1, structureBoundingBoxIn);
|
| 1205 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 2, structureBoundingBoxIn);
|
| 1206 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 0, 5, 3, structureBoundingBoxIn);
|
| 1207 | }
|
| 1208 |
|
| 1209 | if (this.isRoofAccessible)
|
| 1210 | {
|
| 1211 | int i = this.getMetadataWithOffset(Blocks.ladder, 3);
|
| 1212 | this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 1, 3, structureBoundingBoxIn);
|
| 1213 | this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 2, 3, structureBoundingBoxIn);
|
| 1214 | this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 3, 3, structureBoundingBoxIn);
|
| 1215 | this.setBlockState(worldIn, Blocks.ladder.getStateFromMeta(i), 3, 4, 3, structureBoundingBoxIn);
|
| 1216 | }
|
| 1217 |
|
| 1218 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 2, 3, 1, structureBoundingBoxIn);
|
| 1219 |
|
| 1220 | for (int k = 0; k < 5; ++k)
|
| 1221 | {
|
| 1222 | for (int j = 0; j < 5; ++j)
|
| 1223 | {
|
| 1224 | this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, k, structureBoundingBoxIn);
|
| 1225 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j, -1, k, structureBoundingBoxIn);
|
| 1226 | }
|
| 1227 | }
|
| 1228 |
|
| 1229 | this.spawnVillagers(worldIn, structureBoundingBoxIn, 1, 1, 2, 1);
|
| 1230 | return true;
|
| 1231 | }
|
| 1232 | }
|
| 1233 |
|
| 1234 | public static class Path extends StructureVillagePieces.Road
|
| 1235 | {
|
| 1236 | private int length;
|
| 1237 |
|
| 1238 | public Path()
|
| 1239 | {
|
| 1240 | }
|
| 1241 |
|
| 1242 | public Path(StructureVillagePieces.Start start, int p_i45562_2_, Random rand, StructureBoundingBox p_i45562_4_, EnumFacing facing)
|
| 1243 | {
|
| 1244 | super(start, p_i45562_2_);
|
| 1245 | this.coordBaseMode = facing;
|
| 1246 | this.boundingBox = p_i45562_4_;
|
| 1247 | this.length = Math.max(p_i45562_4_.getXSize(), p_i45562_4_.getZSize());
|
| 1248 | }
|
| 1249 |
|
| 1250 | protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
| 1251 | {
|
| 1252 | super.writeStructureToNBT(tagCompound);
|
| 1253 | tagCompound.setInteger("Length", this.length);
|
| 1254 | }
|
| 1255 |
|
| 1256 | protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
| 1257 | {
|
| 1258 | super.readStructureFromNBT(tagCompound);
|
| 1259 | this.length = tagCompound.getInteger("Length");
|
| 1260 | }
|
| 1261 |
|
| 1262 | public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
|
| 1263 | {
|
| 1264 | boolean flag = false;
|
| 1265 |
|
| 1266 | for (int i = rand.nextInt(5); i < this.length - 8; i += 2 + rand.nextInt(5))
|
| 1267 | {
|
| 1268 | StructureComponent structurecomponent = this.getNextComponentNN((StructureVillagePieces.Start)componentIn, listIn, rand, 0, i);
|
| 1269 |
|
| 1270 | if (structurecomponent != null)
|
| 1271 | {
|
| 1272 | i += Math.max(structurecomponent.boundingBox.getXSize(), structurecomponent.boundingBox.getZSize());
|
| 1273 | flag = true;
|
| 1274 | }
|
| 1275 | }
|
| 1276 |
|
| 1277 | for (int j = rand.nextInt(5); j < this.length - 8; j += 2 + rand.nextInt(5))
|
| 1278 | {
|
| 1279 | StructureComponent structurecomponent1 = this.getNextComponentPP((StructureVillagePieces.Start)componentIn, listIn, rand, 0, j);
|
| 1280 |
|
| 1281 | if (structurecomponent1 != null)
|
| 1282 | {
|
| 1283 | j += Math.max(structurecomponent1.boundingBox.getXSize(), structurecomponent1.boundingBox.getZSize());
|
| 1284 | flag = true;
|
| 1285 | }
|
| 1286 | }
|
| 1287 |
|
| 1288 | if (flag && rand.nextInt(3) > 0 && this.coordBaseMode != null)
|
| 1289 | {
|
| 1290 | switch (this.coordBaseMode)
|
| 1291 | {
|
| 1292 | case NORTH:
|
| 1293 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.WEST, this.getComponentType());
|
| 1294 | break;
|
| 1295 |
|
| 1296 | case SOUTH:
|
| 1297 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.WEST, this.getComponentType());
|
| 1298 | break;
|
| 1299 |
|
| 1300 | case WEST:
|
| 1301 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
|
| 1302 | break;
|
| 1303 |
|
| 1304 | case EAST:
|
| 1305 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
|
| 1306 | }
|
| 1307 | }
|
| 1308 |
|
| 1309 | if (flag && rand.nextInt(3) > 0 && this.coordBaseMode != null)
|
| 1310 | {
|
| 1311 | switch (this.coordBaseMode)
|
| 1312 | {
|
| 1313 | case NORTH:
|
| 1314 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.EAST, this.getComponentType());
|
| 1315 | break;
|
| 1316 |
|
| 1317 | case SOUTH:
|
| 1318 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.EAST, this.getComponentType());
|
| 1319 | break;
|
| 1320 |
|
| 1321 | case WEST:
|
| 1322 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
|
| 1323 | break;
|
| 1324 |
|
| 1325 | case EAST:
|
| 1326 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
|
| 1327 | }
|
| 1328 | }
|
| 1329 | }
|
| 1330 |
|
| 1331 | public static StructureBoundingBox func_175848_a(StructureVillagePieces.Start start, List<StructureComponent> p_175848_1_, Random rand, int p_175848_3_, int p_175848_4_, int p_175848_5_, EnumFacing facing)
|
| 1332 | {
|
| 1333 | for (int i = 7 * MathHelper.getRandomIntegerInRange(rand, 3, 5); i >= 7; i -= 7)
|
| 1334 | {
|
| 1335 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175848_3_, p_175848_4_, p_175848_5_, 0, 0, 0, 3, 3, i, facing);
|
| 1336 |
|
| 1337 | if (StructureComponent.findIntersecting(p_175848_1_, structureboundingbox) == null)
|
| 1338 | {
|
| 1339 | return structureboundingbox;
|
| 1340 | }
|
| 1341 | }
|
| 1342 |
|
| 1343 | return null;
|
| 1344 | }
|
| 1345 |
|
| 1346 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 1347 | {
|
| 1348 | IBlockState iblockstate = this.func_175847_a(Blocks.gravel.getDefaultState());
|
| 1349 | IBlockState iblockstate1 = this.func_175847_a(Blocks.cobblestone.getDefaultState());
|
| 1350 |
|
| 1351 | for (int i = this.boundingBox.minX; i <= this.boundingBox.maxX; ++i)
|
| 1352 | {
|
| 1353 | for (int j = this.boundingBox.minZ; j <= this.boundingBox.maxZ; ++j)
|
| 1354 | {
|
| 1355 | BlockPos blockpos = new BlockPos(i, 64, j);
|
| 1356 |
|
| 1357 | if (structureBoundingBoxIn.isVecInside(blockpos))
|
| 1358 | {
|
| 1359 | blockpos = worldIn.getTopSolidOrLiquidBlock(blockpos).down();
|
| 1360 | worldIn.setBlockState(blockpos, iblockstate, 2);
|
| 1361 | worldIn.setBlockState(blockpos.down(), iblockstate1, 2);
|
| 1362 | }
|
| 1363 | }
|
| 1364 | }
|
| 1365 |
|
| 1366 | return true;
|
| 1367 | }
|
| 1368 | }
|
| 1369 |
|
| 1370 | public static class PieceWeight
|
| 1371 | {
|
| 1372 | public Class <? extends StructureVillagePieces.Village > villagePieceClass;
|
| 1373 | public final int villagePieceWeight;
|
| 1374 | public int villagePiecesSpawned;
|
| 1375 | public int villagePiecesLimit;
|
| 1376 |
|
| 1377 | public PieceWeight(Class <? extends StructureVillagePieces.Village > p_i2098_1_, int p_i2098_2_, int p_i2098_3_)
|
| 1378 | {
|
| 1379 | this.villagePieceClass = p_i2098_1_;
|
| 1380 | this.villagePieceWeight = p_i2098_2_;
|
| 1381 | this.villagePiecesLimit = p_i2098_3_;
|
| 1382 | }
|
| 1383 |
|
| 1384 | public boolean canSpawnMoreVillagePiecesOfType(int p_75085_1_)
|
| 1385 | {
|
| 1386 | return this.villagePiecesLimit == 0 || this.villagePiecesSpawned < this.villagePiecesLimit;
|
| 1387 | }
|
| 1388 |
|
| 1389 | public boolean canSpawnMoreVillagePieces()
|
| 1390 | {
|
| 1391 | return this.villagePiecesLimit == 0 || this.villagePiecesSpawned < this.villagePiecesLimit;
|
| 1392 | }
|
| 1393 | }
|
| 1394 |
|
| 1395 | public abstract static class Road extends StructureVillagePieces.Village
|
| 1396 | {
|
| 1397 | public Road()
|
| 1398 | {
|
| 1399 | }
|
| 1400 |
|
| 1401 | protected Road(StructureVillagePieces.Start start, int type)
|
| 1402 | {
|
| 1403 | super(start, type);
|
| 1404 | }
|
| 1405 | }
|
| 1406 |
|
| 1407 | public static class Start extends StructureVillagePieces.Well
|
| 1408 | {
|
| 1409 | public WorldChunkManager worldChunkMngr;
|
| 1410 | public boolean inDesert;
|
| 1411 | public int terrainType;
|
| 1412 | public StructureVillagePieces.PieceWeight structVillagePieceWeight;
|
| 1413 | public List<StructureVillagePieces.PieceWeight> structureVillageWeightedPieceList;
|
| 1414 | public List<StructureComponent> field_74932_i = Lists.<StructureComponent>newArrayList();
|
| 1415 | public List<StructureComponent> field_74930_j = Lists.<StructureComponent>newArrayList();
|
| 1416 |
|
| 1417 | public Start()
|
| 1418 | {
|
| 1419 | }
|
| 1420 |
|
| 1421 | public Start(WorldChunkManager chunkManagerIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureVillagePieces.PieceWeight> p_i2104_6_, int p_i2104_7_)
|
| 1422 | {
|
| 1423 | super((StructureVillagePieces.Start)null, 0, rand, p_i2104_4_, p_i2104_5_);
|
| 1424 | this.worldChunkMngr = chunkManagerIn;
|
| 1425 | this.structureVillageWeightedPieceList = p_i2104_6_;
|
| 1426 | this.terrainType = p_i2104_7_;
|
| 1427 | BiomeGenBase biomegenbase = chunkManagerIn.getBiomeGenerator(new BlockPos(p_i2104_4_, 0, p_i2104_5_), BiomeGenBase.field_180279_ad);
|
| 1428 | this.inDesert = biomegenbase == BiomeGenBase.desert || biomegenbase == BiomeGenBase.desertHills;
|
| 1429 | this.func_175846_a(this.inDesert);
|
| 1430 | }
|
| 1431 |
|
| 1432 | public WorldChunkManager getWorldChunkManager()
|
| 1433 | {
|
| 1434 | return this.worldChunkMngr;
|
| 1435 | }
|
| 1436 | }
|
| 1437 |
|
| 1438 | public static class Torch extends StructureVillagePieces.Village
|
| 1439 | {
|
| 1440 | public Torch()
|
| 1441 | {
|
| 1442 | }
|
| 1443 |
|
| 1444 | public Torch(StructureVillagePieces.Start start, int p_i45568_2_, Random rand, StructureBoundingBox p_i45568_4_, EnumFacing facing)
|
| 1445 | {
|
| 1446 | super(start, p_i45568_2_);
|
| 1447 | this.coordBaseMode = facing;
|
| 1448 | this.boundingBox = p_i45568_4_;
|
| 1449 | }
|
| 1450 |
|
| 1451 | public static StructureBoundingBox func_175856_a(StructureVillagePieces.Start start, List<StructureComponent> p_175856_1_, Random rand, int p_175856_3_, int p_175856_4_, int p_175856_5_, EnumFacing facing)
|
| 1452 | {
|
| 1453 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175856_3_, p_175856_4_, p_175856_5_, 0, 0, 0, 3, 4, 2, facing);
|
| 1454 | return StructureComponent.findIntersecting(p_175856_1_, structureboundingbox) != null ? null : structureboundingbox;
|
| 1455 | }
|
| 1456 |
|
| 1457 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 1458 | {
|
| 1459 | if (this.field_143015_k < 0)
|
| 1460 | {
|
| 1461 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 1462 |
|
| 1463 | if (this.field_143015_k < 0)
|
| 1464 | {
|
| 1465 | return true;
|
| 1466 | }
|
| 1467 |
|
| 1468 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 4 - 1, 0);
|
| 1469 | }
|
| 1470 |
|
| 1471 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 2, 3, 1, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 1472 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 0, 0, structureBoundingBoxIn);
|
| 1473 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
|
| 1474 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
|
| 1475 | this.setBlockState(worldIn, Blocks.wool.getStateFromMeta(EnumDyeColor.WHITE.getDyeDamage()), 1, 3, 0, structureBoundingBoxIn);
|
| 1476 | boolean flag = this.coordBaseMode == EnumFacing.EAST || this.coordBaseMode == EnumFacing.NORTH;
|
| 1477 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateY()), flag ? 2 : 0, 3, 0, structureBoundingBoxIn);
|
| 1478 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode), 1, 3, 1, structureBoundingBoxIn);
|
| 1479 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.rotateYCCW()), flag ? 0 : 2, 3, 0, structureBoundingBoxIn);
|
| 1480 | this.setBlockState(worldIn, Blocks.torch.getDefaultState().withProperty(BlockTorch.FACING, this.coordBaseMode.getOpposite()), 1, 3, -1, structureBoundingBoxIn);
|
| 1481 | return true;
|
| 1482 | }
|
| 1483 | }
|
| 1484 |
|
| 1485 | abstract static class Village extends StructureComponent
|
| 1486 | {
|
| 1487 | protected int field_143015_k = -1;
|
| 1488 | private int villagersSpawned;
|
| 1489 | private boolean isDesertVillage;
|
| 1490 |
|
| 1491 | public Village()
|
| 1492 | {
|
| 1493 | }
|
| 1494 |
|
| 1495 | protected Village(StructureVillagePieces.Start start, int type)
|
| 1496 | {
|
| 1497 | super(type);
|
| 1498 |
|
| 1499 | if (start != null)
|
| 1500 | {
|
| 1501 | this.isDesertVillage = start.inDesert;
|
| 1502 | }
|
| 1503 | }
|
| 1504 |
|
| 1505 | protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
| 1506 | {
|
| 1507 | tagCompound.setInteger("HPos", this.field_143015_k);
|
| 1508 | tagCompound.setInteger("VCount", this.villagersSpawned);
|
| 1509 | tagCompound.setBoolean("Desert", this.isDesertVillage);
|
| 1510 | }
|
| 1511 |
|
| 1512 | protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
| 1513 | {
|
| 1514 | this.field_143015_k = tagCompound.getInteger("HPos");
|
| 1515 | this.villagersSpawned = tagCompound.getInteger("VCount");
|
| 1516 | this.isDesertVillage = tagCompound.getBoolean("Desert");
|
| 1517 | }
|
| 1518 |
|
| 1519 | protected StructureComponent getNextComponentNN(StructureVillagePieces.Start start, List<StructureComponent> p_74891_2_, Random rand, int p_74891_4_, int p_74891_5_)
|
| 1520 | {
|
| 1521 | if (this.coordBaseMode != null)
|
| 1522 | {
|
| 1523 | switch (this.coordBaseMode)
|
| 1524 | {
|
| 1525 | case NORTH:
|
| 1526 | return StructureVillagePieces.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX - 1, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ + p_74891_5_, EnumFacing.WEST, this.getComponentType());
|
| 1527 |
|
| 1528 | case SOUTH:
|
| 1529 | return StructureVillagePieces.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX - 1, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ + p_74891_5_, EnumFacing.WEST, this.getComponentType());
|
| 1530 |
|
| 1531 | case WEST:
|
| 1532 | return StructureVillagePieces.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX + p_74891_5_, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
|
| 1533 |
|
| 1534 | case EAST:
|
| 1535 | return StructureVillagePieces.func_176066_d(start, p_74891_2_, rand, this.boundingBox.minX + p_74891_5_, this.boundingBox.minY + p_74891_4_, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
|
| 1536 | }
|
| 1537 | }
|
| 1538 |
|
| 1539 | return null;
|
| 1540 | }
|
| 1541 |
|
| 1542 | protected StructureComponent getNextComponentPP(StructureVillagePieces.Start start, List<StructureComponent> p_74894_2_, Random rand, int p_74894_4_, int p_74894_5_)
|
| 1543 | {
|
| 1544 | if (this.coordBaseMode != null)
|
| 1545 | {
|
| 1546 | switch (this.coordBaseMode)
|
| 1547 | {
|
| 1548 | case NORTH:
|
| 1549 | return StructureVillagePieces.func_176066_d(start, p_74894_2_, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74894_4_, this.boundingBox.minZ + p_74894_5_, EnumFacing.EAST, this.getComponentType());
|
| 1550 |
|
| 1551 | case SOUTH:
|
| 1552 | return StructureVillagePieces.func_176066_d(start, p_74894_2_, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + p_74894_4_, this.boundingBox.minZ + p_74894_5_, EnumFacing.EAST, this.getComponentType());
|
| 1553 |
|
| 1554 | case WEST:
|
| 1555 | return StructureVillagePieces.func_176066_d(start, p_74894_2_, rand, this.boundingBox.minX + p_74894_5_, this.boundingBox.minY + p_74894_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
|
| 1556 |
|
| 1557 | case EAST:
|
| 1558 | return StructureVillagePieces.func_176066_d(start, p_74894_2_, rand, this.boundingBox.minX + p_74894_5_, this.boundingBox.minY + p_74894_4_, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
|
| 1559 | }
|
| 1560 | }
|
| 1561 |
|
| 1562 | return null;
|
| 1563 | }
|
| 1564 |
|
| 1565 | protected int getAverageGroundLevel(World worldIn, StructureBoundingBox p_74889_2_)
|
| 1566 | {
|
| 1567 | int i = 0;
|
| 1568 | int j = 0;
|
| 1569 | BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
| 1570 |
|
| 1571 | for (int k = this.boundingBox.minZ; k <= this.boundingBox.maxZ; ++k)
|
| 1572 | {
|
| 1573 | for (int l = this.boundingBox.minX; l <= this.boundingBox.maxX; ++l)
|
| 1574 | {
|
| 1575 | blockpos$mutableblockpos.set(l, 64, k);
|
| 1576 |
|
| 1577 | if (p_74889_2_.isVecInside(blockpos$mutableblockpos))
|
| 1578 | {
|
| 1579 | i += Math.max(worldIn.getTopSolidOrLiquidBlock(blockpos$mutableblockpos).getY(), worldIn.provider.getAverageGroundLevel());
|
| 1580 | ++j;
|
| 1581 | }
|
| 1582 | }
|
| 1583 | }
|
| 1584 |
|
| 1585 | if (j == 0)
|
| 1586 | {
|
| 1587 | return -1;
|
| 1588 | }
|
| 1589 | else
|
| 1590 | {
|
| 1591 | return i / j;
|
| 1592 | }
|
| 1593 | }
|
| 1594 |
|
| 1595 | protected static boolean canVillageGoDeeper(StructureBoundingBox p_74895_0_)
|
| 1596 | {
|
| 1597 | return p_74895_0_ != null && p_74895_0_.minY > 10;
|
| 1598 | }
|
| 1599 |
|
| 1600 | protected void spawnVillagers(World worldIn, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
|
| 1601 | {
|
| 1602 | if (this.villagersSpawned < p_74893_6_)
|
| 1603 | {
|
| 1604 | for (int i = this.villagersSpawned; i < p_74893_6_; ++i)
|
| 1605 | {
|
| 1606 | int j = this.getXWithOffset(p_74893_3_ + i, p_74893_5_);
|
| 1607 | int k = this.getYWithOffset(p_74893_4_);
|
| 1608 | int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_);
|
| 1609 |
|
| 1610 | if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
|
| 1611 | {
|
| 1612 | break;
|
| 1613 | }
|
| 1614 |
|
| 1615 | ++this.villagersSpawned;
|
| 1616 | EntityVillager entityvillager = new EntityVillager(worldIn);
|
| 1617 | entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
|
| 1618 | entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
|
| 1619 | entityvillager.setProfession(this.func_180779_c(i, entityvillager.getProfession()));
|
| 1620 | worldIn.spawnEntityInWorld(entityvillager);
|
| 1621 | }
|
| 1622 | }
|
| 1623 | }
|
| 1624 |
|
| 1625 | protected int func_180779_c(int p_180779_1_, int p_180779_2_)
|
| 1626 | {
|
| 1627 | return p_180779_2_;
|
| 1628 | }
|
| 1629 |
|
| 1630 | protected IBlockState func_175847_a(IBlockState p_175847_1_)
|
| 1631 | {
|
| 1632 | if (this.isDesertVillage)
|
| 1633 | {
|
| 1634 | if (p_175847_1_.getBlock() == Blocks.log || p_175847_1_.getBlock() == Blocks.log2)
|
| 1635 | {
|
| 1636 | return Blocks.sandstone.getDefaultState();
|
| 1637 | }
|
| 1638 |
|
| 1639 | if (p_175847_1_.getBlock() == Blocks.cobblestone)
|
| 1640 | {
|
| 1641 | return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.DEFAULT.getMetadata());
|
| 1642 | }
|
| 1643 |
|
| 1644 | if (p_175847_1_.getBlock() == Blocks.planks)
|
| 1645 | {
|
| 1646 | return Blocks.sandstone.getStateFromMeta(BlockSandStone.EnumType.SMOOTH.getMetadata());
|
| 1647 | }
|
| 1648 |
|
| 1649 | if (p_175847_1_.getBlock() == Blocks.oak_stairs)
|
| 1650 | {
|
| 1651 | return Blocks.sandstone_stairs.getDefaultState().withProperty(BlockStairs.FACING, p_175847_1_.getValue(BlockStairs.FACING));
|
| 1652 | }
|
| 1653 |
|
| 1654 | if (p_175847_1_.getBlock() == Blocks.stone_stairs)
|
| 1655 | {
|
| 1656 | return Blocks.sandstone_stairs.getDefaultState().withProperty(BlockStairs.FACING, p_175847_1_.getValue(BlockStairs.FACING));
|
| 1657 | }
|
| 1658 |
|
| 1659 | if (p_175847_1_.getBlock() == Blocks.gravel)
|
| 1660 | {
|
| 1661 | return Blocks.sandstone.getDefaultState();
|
| 1662 | }
|
| 1663 | }
|
| 1664 |
|
| 1665 | return p_175847_1_;
|
| 1666 | }
|
| 1667 |
|
| 1668 | protected void setBlockState(World worldIn, IBlockState blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn)
|
| 1669 | {
|
| 1670 | IBlockState iblockstate = this.func_175847_a(blockstateIn);
|
| 1671 | super.setBlockState(worldIn, iblockstate, x, y, z, boundingboxIn);
|
| 1672 | }
|
| 1673 |
|
| 1674 | protected void fillWithBlocks(World worldIn, StructureBoundingBox boundingboxIn, int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, IBlockState boundaryBlockState, IBlockState insideBlockState, boolean existingOnly)
|
| 1675 | {
|
| 1676 | IBlockState iblockstate = this.func_175847_a(boundaryBlockState);
|
| 1677 | IBlockState iblockstate1 = this.func_175847_a(insideBlockState);
|
| 1678 | super.fillWithBlocks(worldIn, boundingboxIn, xMin, yMin, zMin, xMax, yMax, zMax, iblockstate, iblockstate1, existingOnly);
|
| 1679 | }
|
| 1680 |
|
| 1681 | protected void replaceAirAndLiquidDownwards(World worldIn, IBlockState blockstateIn, int x, int y, int z, StructureBoundingBox boundingboxIn)
|
| 1682 | {
|
| 1683 | IBlockState iblockstate = this.func_175847_a(blockstateIn);
|
| 1684 | super.replaceAirAndLiquidDownwards(worldIn, iblockstate, x, y, z, boundingboxIn);
|
| 1685 | }
|
| 1686 |
|
| 1687 | protected void func_175846_a(boolean p_175846_1_)
|
| 1688 | {
|
| 1689 | this.isDesertVillage = p_175846_1_;
|
| 1690 | }
|
| 1691 | }
|
| 1692 |
|
| 1693 | public static class Well extends StructureVillagePieces.Village
|
| 1694 | {
|
| 1695 | public Well()
|
| 1696 | {
|
| 1697 | }
|
| 1698 |
|
| 1699 | public Well(StructureVillagePieces.Start start, int p_i2109_2_, Random rand, int p_i2109_4_, int p_i2109_5_)
|
| 1700 | {
|
| 1701 | super(start, p_i2109_2_);
|
| 1702 | this.coordBaseMode = EnumFacing.Plane.HORIZONTAL.random(rand);
|
| 1703 |
|
| 1704 | switch (this.coordBaseMode)
|
| 1705 | {
|
| 1706 | case NORTH:
|
| 1707 | case SOUTH:
|
| 1708 | this.boundingBox = new StructureBoundingBox(p_i2109_4_, 64, p_i2109_5_, p_i2109_4_ + 6 - 1, 78, p_i2109_5_ + 6 - 1);
|
| 1709 | break;
|
| 1710 |
|
| 1711 | default:
|
| 1712 | this.boundingBox = new StructureBoundingBox(p_i2109_4_, 64, p_i2109_5_, p_i2109_4_ + 6 - 1, 78, p_i2109_5_ + 6 - 1);
|
| 1713 | }
|
| 1714 | }
|
| 1715 |
|
| 1716 | public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
|
| 1717 | {
|
| 1718 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, EnumFacing.WEST, this.getComponentType());
|
| 1719 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, EnumFacing.EAST, this.getComponentType());
|
| 1720 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
|
| 1721 | StructureVillagePieces.func_176069_e((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
|
| 1722 | }
|
| 1723 |
|
| 1724 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 1725 | {
|
| 1726 | if (this.field_143015_k < 0)
|
| 1727 | {
|
| 1728 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 1729 |
|
| 1730 | if (this.field_143015_k < 0)
|
| 1731 | {
|
| 1732 | return true;
|
| 1733 | }
|
| 1734 |
|
| 1735 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 3, 0);
|
| 1736 | }
|
| 1737 |
|
| 1738 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 4, 12, 4, Blocks.cobblestone.getDefaultState(), Blocks.flowing_water.getDefaultState(), false);
|
| 1739 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 12, 2, structureBoundingBoxIn);
|
| 1740 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 3, 12, 2, structureBoundingBoxIn);
|
| 1741 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 2, 12, 3, structureBoundingBoxIn);
|
| 1742 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 3, 12, 3, structureBoundingBoxIn);
|
| 1743 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 13, 1, structureBoundingBoxIn);
|
| 1744 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 14, 1, structureBoundingBoxIn);
|
| 1745 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 13, 1, structureBoundingBoxIn);
|
| 1746 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 14, 1, structureBoundingBoxIn);
|
| 1747 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 13, 4, structureBoundingBoxIn);
|
| 1748 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 1, 14, 4, structureBoundingBoxIn);
|
| 1749 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 13, 4, structureBoundingBoxIn);
|
| 1750 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), 4, 14, 4, structureBoundingBoxIn);
|
| 1751 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 15, 1, 4, 15, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 1752 |
|
| 1753 | for (int i = 0; i <= 5; ++i)
|
| 1754 | {
|
| 1755 | for (int j = 0; j <= 5; ++j)
|
| 1756 | {
|
| 1757 | if (j == 0 || j == 5 || i == 0 || i == 5)
|
| 1758 | {
|
| 1759 | this.setBlockState(worldIn, Blocks.gravel.getDefaultState(), j, 11, i, structureBoundingBoxIn);
|
| 1760 | this.clearCurrentPositionBlocksUpwards(worldIn, j, 12, i, structureBoundingBoxIn);
|
| 1761 | }
|
| 1762 | }
|
| 1763 | }
|
| 1764 |
|
| 1765 | return true;
|
| 1766 | }
|
| 1767 | }
|
| 1768 |
|
| 1769 | public static class WoodHut extends StructureVillagePieces.Village
|
| 1770 | {
|
| 1771 | private boolean isTallHouse;
|
| 1772 | private int tablePosition;
|
| 1773 |
|
| 1774 | public WoodHut()
|
| 1775 | {
|
| 1776 | }
|
| 1777 |
|
| 1778 | public WoodHut(StructureVillagePieces.Start start, int p_i45565_2_, Random rand, StructureBoundingBox p_i45565_4_, EnumFacing facing)
|
| 1779 | {
|
| 1780 | super(start, p_i45565_2_);
|
| 1781 | this.coordBaseMode = facing;
|
| 1782 | this.boundingBox = p_i45565_4_;
|
| 1783 | this.isTallHouse = rand.nextBoolean();
|
| 1784 | this.tablePosition = rand.nextInt(3);
|
| 1785 | }
|
| 1786 |
|
| 1787 | protected void writeStructureToNBT(NBTTagCompound tagCompound)
|
| 1788 | {
|
| 1789 | super.writeStructureToNBT(tagCompound);
|
| 1790 | tagCompound.setInteger("T", this.tablePosition);
|
| 1791 | tagCompound.setBoolean("C", this.isTallHouse);
|
| 1792 | }
|
| 1793 |
|
| 1794 | protected void readStructureFromNBT(NBTTagCompound tagCompound)
|
| 1795 | {
|
| 1796 | super.readStructureFromNBT(tagCompound);
|
| 1797 | this.tablePosition = tagCompound.getInteger("T");
|
| 1798 | this.isTallHouse = tagCompound.getBoolean("C");
|
| 1799 | }
|
| 1800 |
|
| 1801 | public static StructureVillagePieces.WoodHut func_175853_a(StructureVillagePieces.Start start, List<StructureComponent> p_175853_1_, Random rand, int p_175853_3_, int p_175853_4_, int p_175853_5_, EnumFacing facing, int p_175853_7_)
|
| 1802 | {
|
| 1803 | StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175853_3_, p_175853_4_, p_175853_5_, 0, 0, 0, 4, 6, 5, facing);
|
| 1804 | return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new StructureVillagePieces.WoodHut(start, p_175853_7_, rand, structureboundingbox, facing) : null;
|
| 1805 | }
|
| 1806 |
|
| 1807 | public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
|
| 1808 | {
|
| 1809 | if (this.field_143015_k < 0)
|
| 1810 | {
|
| 1811 | this.field_143015_k = this.getAverageGroundLevel(worldIn, structureBoundingBoxIn);
|
| 1812 |
|
| 1813 | if (this.field_143015_k < 0)
|
| 1814 | {
|
| 1815 | return true;
|
| 1816 | }
|
| 1817 |
|
| 1818 | this.boundingBox.offset(0, this.field_143015_k - this.boundingBox.maxY + 6 - 1, 0);
|
| 1819 | }
|
| 1820 |
|
| 1821 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 1, 3, 5, 4, Blocks.air.getDefaultState(), Blocks.air.getDefaultState(), false);
|
| 1822 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 0, 0, 3, 0, 4, Blocks.cobblestone.getDefaultState(), Blocks.cobblestone.getDefaultState(), false);
|
| 1823 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 0, 1, 2, 0, 3, Blocks.dirt.getDefaultState(), Blocks.dirt.getDefaultState(), false);
|
| 1824 |
|
| 1825 | if (this.isTallHouse)
|
| 1826 | {
|
| 1827 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 4, 1, 2, 4, 3, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 1828 | }
|
| 1829 | else
|
| 1830 | {
|
| 1831 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 5, 1, 2, 5, 3, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 1832 | }
|
| 1833 |
|
| 1834 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 1, 4, 0, structureBoundingBoxIn);
|
| 1835 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 2, 4, 0, structureBoundingBoxIn);
|
| 1836 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 1, 4, 4, structureBoundingBoxIn);
|
| 1837 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 2, 4, 4, structureBoundingBoxIn);
|
| 1838 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 4, 1, structureBoundingBoxIn);
|
| 1839 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 4, 2, structureBoundingBoxIn);
|
| 1840 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 0, 4, 3, structureBoundingBoxIn);
|
| 1841 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 3, 4, 1, structureBoundingBoxIn);
|
| 1842 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 3, 4, 2, structureBoundingBoxIn);
|
| 1843 | this.setBlockState(worldIn, Blocks.log.getDefaultState(), 3, 4, 3, structureBoundingBoxIn);
|
| 1844 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 0, 0, 3, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 1845 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 0, 3, 3, 0, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 1846 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 4, 0, 3, 4, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 1847 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 4, 3, 3, 4, Blocks.log.getDefaultState(), Blocks.log.getDefaultState(), false);
|
| 1848 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 0, 1, 1, 0, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1849 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 3, 1, 1, 3, 3, 3, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1850 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 0, 2, 3, 0, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1851 | this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 1, 4, 2, 3, 4, Blocks.planks.getDefaultState(), Blocks.planks.getDefaultState(), false);
|
| 1852 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 0, 2, 2, structureBoundingBoxIn);
|
| 1853 | this.setBlockState(worldIn, Blocks.glass_pane.getDefaultState(), 3, 2, 2, structureBoundingBoxIn);
|
| 1854 |
|
| 1855 | if (this.tablePosition > 0)
|
| 1856 | {
|
| 1857 | this.setBlockState(worldIn, Blocks.oak_fence.getDefaultState(), this.tablePosition, 1, 3, structureBoundingBoxIn);
|
| 1858 | this.setBlockState(worldIn, Blocks.wooden_pressure_plate.getDefaultState(), this.tablePosition, 2, 3, structureBoundingBoxIn);
|
| 1859 | }
|
| 1860 |
|
| 1861 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 1, 0, structureBoundingBoxIn);
|
| 1862 | this.setBlockState(worldIn, Blocks.air.getDefaultState(), 1, 2, 0, structureBoundingBoxIn);
|
| 1863 | this.placeDoorCurrentPosition(worldIn, structureBoundingBoxIn, randomIn, 1, 1, 0, EnumFacing.getHorizontal(this.getMetadataWithOffset(Blocks.oak_door, 1)));
|
| 1864 |
|
| 1865 | if (this.getBlockStateFromPos(worldIn, 1, 0, -1, structureBoundingBoxIn).getBlock().getMaterial() == Material.air && this.getBlockStateFromPos(worldIn, 1, -1, -1, structureBoundingBoxIn).getBlock().getMaterial() != Material.air)
|
| 1866 | {
|
| 1867 | this.setBlockState(worldIn, Blocks.stone_stairs.getStateFromMeta(this.getMetadataWithOffset(Blocks.stone_stairs, 3)), 1, 0, -1, structureBoundingBoxIn);
|
| 1868 | }
|
| 1869 |
|
| 1870 | for (int i = 0; i < 5; ++i)
|
| 1871 | {
|
| 1872 | for (int j = 0; j < 4; ++j)
|
| 1873 | {
|
| 1874 | this.clearCurrentPositionBlocksUpwards(worldIn, j, 6, i, structureBoundingBoxIn);
|
| 1875 | this.replaceAirAndLiquidDownwards(worldIn, Blocks.cobblestone.getDefaultState(), j, -1, i, structureBoundingBoxIn);
|
| 1876 | }
|
| 1877 | }
|
| 1878 |
|
| 1879 | this.spawnVillagers(worldIn, structureBoundingBoxIn, 1, 1, 2, 1);
|
| 1880 | return true;
|
| 1881 | }
|
| 1882 | }
|
| 1883 | }
|
| 1884 |
|