Files
CatServer/patches/net/minecraft/world/gen/structure/StructureVillagePieces.java.patch
2019-02-24 22:29:41 +08:00

775 lines
52 KiB
Diff

--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java
+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java
@@ -41,34 +41,35 @@
{
public static void registerVillagePieces()
{
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House1.class, "ViBH");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field1.class, "ViDF");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Field2.class, "ViF");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Torch.class, "ViL");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Hall.class, "ViPH");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House4Garden.class, "ViSH");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.WoodHut.class, "ViSmH");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Church.class, "ViST");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House2.class, "ViS");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Start.class, "ViStart");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Path.class, "ViSR");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.House3.class, "ViTRH");
- MapGenStructureIO.registerStructureComponent(StructureVillagePieces.Well.class, "ViW");
+ MapGenStructureIO.registerStructureComponent(House1.class, "ViBH");
+ MapGenStructureIO.registerStructureComponent(Field1.class, "ViDF");
+ MapGenStructureIO.registerStructureComponent(Field2.class, "ViF");
+ MapGenStructureIO.registerStructureComponent(Torch.class, "ViL");
+ MapGenStructureIO.registerStructureComponent(Hall.class, "ViPH");
+ MapGenStructureIO.registerStructureComponent(House4Garden.class, "ViSH");
+ MapGenStructureIO.registerStructureComponent(WoodHut.class, "ViSmH");
+ MapGenStructureIO.registerStructureComponent(Church.class, "ViST");
+ MapGenStructureIO.registerStructureComponent(House2.class, "ViS");
+ MapGenStructureIO.registerStructureComponent(Start.class, "ViStart");
+ MapGenStructureIO.registerStructureComponent(Path.class, "ViSR");
+ MapGenStructureIO.registerStructureComponent(House3.class, "ViTRH");
+ MapGenStructureIO.registerStructureComponent(Well.class, "ViW");
}
- public static List<StructureVillagePieces.PieceWeight> getStructureVillageWeightedPieceList(Random random, int size)
+ public static List<PieceWeight> getStructureVillageWeightedPieceList(Random random, int size)
{
- List<StructureVillagePieces.PieceWeight> list = Lists.<StructureVillagePieces.PieceWeight>newArrayList();
- list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House4Garden.class, 4, MathHelper.getInt(random, 2 + size, 4 + size * 2)));
- list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Church.class, 20, MathHelper.getInt(random, 0 + size, 1 + size)));
- list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House1.class, 20, MathHelper.getInt(random, 0 + size, 2 + size)));
- list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.WoodHut.class, 3, MathHelper.getInt(random, 2 + size, 5 + size * 3)));
- list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Hall.class, 15, MathHelper.getInt(random, 0 + size, 2 + size)));
- list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field1.class, 3, MathHelper.getInt(random, 1 + size, 4 + size)));
- list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.getInt(random, 2 + size, 4 + size * 2)));
- list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.getInt(random, 0, 1 + size)));
- list.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.getInt(random, 0 + size, 3 + size * 2)));
- Iterator<StructureVillagePieces.PieceWeight> iterator = list.iterator();
+ List<PieceWeight> list = Lists.<PieceWeight>newArrayList();
+ list.add(new PieceWeight(House4Garden.class, 4, MathHelper.getInt(random, 2 + size, 4 + size * 2)));
+ list.add(new PieceWeight(Church.class, 20, MathHelper.getInt(random, 0 + size, 1 + size)));
+ list.add(new PieceWeight(House1.class, 20, MathHelper.getInt(random, 0 + size, 2 + size)));
+ list.add(new PieceWeight(WoodHut.class, 3, MathHelper.getInt(random, 2 + size, 5 + size * 3)));
+ list.add(new PieceWeight(Hall.class, 15, MathHelper.getInt(random, 0 + size, 2 + size)));
+ list.add(new PieceWeight(Field1.class, 3, MathHelper.getInt(random, 1 + size, 4 + size)));
+ list.add(new PieceWeight(Field2.class, 3, MathHelper.getInt(random, 2 + size, 4 + size * 2)));
+ list.add(new PieceWeight(House2.class, 15, MathHelper.getInt(random, 0, 1 + size)));
+ list.add(new PieceWeight(House3.class, 8, MathHelper.getInt(random, 0 + size, 3 + size * 2)));
+ net.minecraftforge.fml.common.registry.VillagerRegistry.addExtraVillageComponents(list, random, size);
+ Iterator<PieceWeight> iterator = list.iterator();
while (iterator.hasNext())
{
@@ -81,12 +82,12 @@
return list;
}
- private static int updatePieceWeight(List<StructureVillagePieces.PieceWeight> p_75079_0_)
+ private static int updatePieceWeight(List<PieceWeight> p_75079_0_)
{
boolean flag = false;
int i = 0;
- for (StructureVillagePieces.PieceWeight structurevillagepieces$pieceweight : p_75079_0_)
+ for (PieceWeight structurevillagepieces$pieceweight : p_75079_0_)
{
if (structurevillagepieces$pieceweight.villagePiecesLimit > 0 && structurevillagepieces$pieceweight.villagePiecesSpawned < structurevillagepieces$pieceweight.villagePiecesLimit)
{
@@ -99,52 +100,56 @@
return flag ? i : -1;
}
- private static StructureVillagePieces.Village findAndCreateComponentFactory(StructureVillagePieces.Start start, StructureVillagePieces.PieceWeight weight, List<StructureComponent> structureComponents, Random rand, int structureMinX, int structureMinY, int structureMinZ, EnumFacing facing, int componentType)
+ private static Village findAndCreateComponentFactory(Start start, PieceWeight weight, List<StructureComponent> structureComponents, Random rand, int structureMinX, int structureMinY, int structureMinZ, EnumFacing facing, int componentType)
{
- Class <? extends StructureVillagePieces.Village > oclass = weight.villagePieceClass;
- StructureVillagePieces.Village structurevillagepieces$village = null;
+ Class <? extends Village > oclass = weight.villagePieceClass;
+ Village structurevillagepieces$village = null;
- if (oclass == StructureVillagePieces.House4Garden.class)
+ if (oclass == House4Garden.class)
{
- structurevillagepieces$village = StructureVillagePieces.House4Garden.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ structurevillagepieces$village = House4Garden.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
}
- else if (oclass == StructureVillagePieces.Church.class)
+ else if (oclass == Church.class)
{
- structurevillagepieces$village = StructureVillagePieces.Church.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ structurevillagepieces$village = Church.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
}
- else if (oclass == StructureVillagePieces.House1.class)
+ else if (oclass == House1.class)
{
- structurevillagepieces$village = StructureVillagePieces.House1.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ structurevillagepieces$village = House1.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
}
- else if (oclass == StructureVillagePieces.WoodHut.class)
+ else if (oclass == WoodHut.class)
{
- structurevillagepieces$village = StructureVillagePieces.WoodHut.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ structurevillagepieces$village = WoodHut.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
}
- else if (oclass == StructureVillagePieces.Hall.class)
+ else if (oclass == Hall.class)
{
- structurevillagepieces$village = StructureVillagePieces.Hall.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ structurevillagepieces$village = Hall.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
}
- else if (oclass == StructureVillagePieces.Field1.class)
+ else if (oclass == Field1.class)
{
- structurevillagepieces$village = StructureVillagePieces.Field1.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ structurevillagepieces$village = Field1.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
}
- else if (oclass == StructureVillagePieces.Field2.class)
+ else if (oclass == Field2.class)
{
- structurevillagepieces$village = StructureVillagePieces.Field2.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ structurevillagepieces$village = Field2.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
}
- else if (oclass == StructureVillagePieces.House2.class)
+ else if (oclass == House2.class)
{
- structurevillagepieces$village = StructureVillagePieces.House2.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ structurevillagepieces$village = House2.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
}
- else if (oclass == StructureVillagePieces.House3.class)
+ else if (oclass == House3.class)
{
- structurevillagepieces$village = StructureVillagePieces.House3.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ structurevillagepieces$village = House3.createPiece(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
}
+ else
+ {
+ structurevillagepieces$village = net.minecraftforge.fml.common.registry.VillagerRegistry.getVillageComponent(weight, start , structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ }
return structurevillagepieces$village;
}
- private static StructureVillagePieces.Village generateComponent(StructureVillagePieces.Start start, List<StructureComponent> structureComponents, Random rand, int structureMinX, int structureMinY, int structureMinZ, EnumFacing facing, int componentType)
+ private static Village generateComponent(Start start, List<StructureComponent> structureComponents, Random rand, int structureMinX, int structureMinY, int structureMinZ, EnumFacing facing, int componentType)
{
int i = updatePieceWeight(start.structureVillageWeightedPieceList);
@@ -161,7 +166,7 @@
++j;
int k = rand.nextInt(i);
- for (StructureVillagePieces.PieceWeight structurevillagepieces$pieceweight : start.structureVillageWeightedPieceList)
+ for (PieceWeight structurevillagepieces$pieceweight : start.structureVillageWeightedPieceList)
{
k -= structurevillagepieces$pieceweight.villagePieceWeight;
@@ -172,7 +177,7 @@
break;
}
- StructureVillagePieces.Village structurevillagepieces$village = findAndCreateComponentFactory(start, structurevillagepieces$pieceweight, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
+ Village structurevillagepieces$village = findAndCreateComponentFactory(start, structurevillagepieces$pieceweight, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing, componentType);
if (structurevillagepieces$village != null)
{
@@ -190,11 +195,11 @@
}
}
- StructureBoundingBox structureboundingbox = StructureVillagePieces.Torch.findPieceBox(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing);
+ StructureBoundingBox structureboundingbox = Torch.findPieceBox(start, structureComponents, rand, structureMinX, structureMinY, structureMinZ, facing);
if (structureboundingbox != null)
{
- return new StructureVillagePieces.Torch(start, componentType, rand, structureboundingbox, facing);
+ return new Torch(start, componentType, rand, structureboundingbox, facing);
}
else
{
@@ -203,7 +208,7 @@
}
}
- private static StructureComponent generateAndAddComponent(StructureVillagePieces.Start start, List<StructureComponent> structureComponents, Random rand, int structureMinX, int structureMinY, int structureMinZ, EnumFacing facing, int componentType)
+ private static StructureComponent generateAndAddComponent(Start start, List<StructureComponent> structureComponents, Random rand, int structureMinX, int structureMinY, int structureMinZ, EnumFacing facing, int componentType)
{
if (componentType > 50)
{
@@ -230,7 +235,7 @@
}
}
- private static StructureComponent generateAndAddRoadPiece(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_)
+ private static StructureComponent generateAndAddRoadPiece(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_)
{
if (p_176069_7_ > 3 + start.terrainType)
{
@@ -238,11 +243,11 @@
}
else if (Math.abs(p_176069_3_ - start.getBoundingBox().minX) <= 112 && Math.abs(p_176069_5_ - start.getBoundingBox().minZ) <= 112)
{
- StructureBoundingBox structureboundingbox = StructureVillagePieces.Path.findPieceBox(start, p_176069_1_, rand, p_176069_3_, p_176069_4_, p_176069_5_, facing);
+ StructureBoundingBox structureboundingbox = Path.findPieceBox(start, p_176069_1_, rand, p_176069_3_, p_176069_4_, p_176069_5_, facing);
if (structureboundingbox != null && structureboundingbox.minY > 10)
{
- StructureComponent structurecomponent = new StructureVillagePieces.Path(start, p_176069_7_, rand, structureboundingbox, facing);
+ StructureComponent structurecomponent = new Path(start, p_176069_7_, rand, structureboundingbox, facing);
p_176069_1_.add(structurecomponent);
start.pendingRoads.add(structurecomponent);
return structurecomponent;
@@ -258,23 +263,23 @@
}
}
- public static class Church extends StructureVillagePieces.Village
+ public static class Church extends Village
{
public Church()
{
}
- public Church(StructureVillagePieces.Start start, int type, Random rand, StructureBoundingBox p_i45564_4_, EnumFacing facing)
+ public Church(Start start, int type, Random rand, StructureBoundingBox p_i45564_4_, EnumFacing facing)
{
super(start, type);
this.setCoordBaseMode(facing);
this.boundingBox = p_i45564_4_;
}
- public static StructureVillagePieces.Church createPiece(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_)
+ public static Church createPiece(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_)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175854_3_, p_175854_4_, p_175854_5_, 0, 0, 0, 5, 12, 9, facing);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175854_1_, structureboundingbox) == null ? new StructureVillagePieces.Church(start, p_175854_7_, rand, structureboundingbox, facing) : null;
+ return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175854_1_, structureboundingbox) == null ? new Church(start, p_175854_7_, rand, structureboundingbox, facing) : null;
}
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@@ -381,7 +386,7 @@
}
}
- public static class Field1 extends StructureVillagePieces.Village
+ public static class Field1 extends Village
{
private Block cropTypeA;
private Block cropTypeB;
@@ -392,7 +397,7 @@
{
}
- public Field1(StructureVillagePieces.Start start, int type, Random rand, StructureBoundingBox p_i45570_4_, EnumFacing facing)
+ public Field1(Start start, int type, Random rand, StructureBoundingBox p_i45570_4_, EnumFacing facing)
{
super(start, type);
this.setCoordBaseMode(facing);
@@ -458,10 +463,10 @@
}
}
- public static StructureVillagePieces.Field1 createPiece(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_)
+ public static Field1 createPiece(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_)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175851_3_, p_175851_4_, p_175851_5_, 0, 0, 0, 13, 4, 9, facing);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175851_1_, structureboundingbox) == null ? new StructureVillagePieces.Field1(start, p_175851_7_, rand, structureboundingbox, facing) : null;
+ return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175851_1_, structureboundingbox) == null ? new Field1(start, p_175851_7_, rand, structureboundingbox, facing) : null;
}
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@@ -525,7 +530,7 @@
}
}
- public static class Field2 extends StructureVillagePieces.Village
+ public static class Field2 extends Village
{
private Block cropTypeA;
private Block cropTypeB;
@@ -534,7 +539,7 @@
{
}
- public Field2(StructureVillagePieces.Start start, int p_i45569_2_, Random rand, StructureBoundingBox p_i45569_4_, EnumFacing facing)
+ public Field2(Start start, int p_i45569_2_, Random rand, StructureBoundingBox p_i45569_4_, EnumFacing facing)
{
super(start, p_i45569_2_);
this.setCoordBaseMode(facing);
@@ -574,10 +579,10 @@
}
}
- public static StructureVillagePieces.Field2 createPiece(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_)
+ public static Field2 createPiece(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_)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175852_3_, p_175852_4_, p_175852_5_, 0, 0, 0, 7, 4, 9, facing);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175852_1_, structureboundingbox) == null ? new StructureVillagePieces.Field2(start, p_175852_7_, rand, structureboundingbox, facing) : null;
+ return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175852_1_, structureboundingbox) == null ? new Field2(start, p_175852_7_, rand, structureboundingbox, facing) : null;
}
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@@ -629,23 +634,23 @@
}
}
- public static class Hall extends StructureVillagePieces.Village
+ public static class Hall extends Village
{
public Hall()
{
}
- public Hall(StructureVillagePieces.Start start, int type, Random rand, StructureBoundingBox p_i45567_4_, EnumFacing facing)
+ public Hall(Start start, int type, Random rand, StructureBoundingBox p_i45567_4_, EnumFacing facing)
{
super(start, type);
this.setCoordBaseMode(facing);
this.boundingBox = p_i45567_4_;
}
- public static StructureVillagePieces.Hall createPiece(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_)
+ public static Hall createPiece(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_)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175857_3_, p_175857_4_, p_175857_5_, 0, 0, 0, 9, 7, 11, facing);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175857_1_, structureboundingbox) == null ? new StructureVillagePieces.Hall(start, p_175857_7_, rand, structureboundingbox, facing) : null;
+ return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175857_1_, structureboundingbox) == null ? new Hall(start, p_175857_7_, rand, structureboundingbox, facing) : null;
}
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@@ -761,23 +766,23 @@
}
}
- public static class House1 extends StructureVillagePieces.Village
+ public static class House1 extends Village
{
public House1()
{
}
- public House1(StructureVillagePieces.Start start, int type, Random rand, StructureBoundingBox p_i45571_4_, EnumFacing facing)
+ public House1(Start start, int type, Random rand, StructureBoundingBox p_i45571_4_, EnumFacing facing)
{
super(start, type);
this.setCoordBaseMode(facing);
this.boundingBox = p_i45571_4_;
}
- public static StructureVillagePieces.House1 createPiece(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_)
+ public static House1 createPiece(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_)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175850_3_, p_175850_4_, p_175850_5_, 0, 0, 0, 9, 9, 6, facing);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175850_1_, structureboundingbox) == null ? new StructureVillagePieces.House1(start, p_175850_7_, rand, structureboundingbox, facing) : null;
+ return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175850_1_, structureboundingbox) == null ? new House1(start, p_175850_7_, rand, structureboundingbox, facing) : null;
}
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@@ -893,7 +898,7 @@
}
}
- public static class House2 extends StructureVillagePieces.Village
+ public static class House2 extends Village
{
private boolean hasMadeChest;
@@ -901,17 +906,17 @@
{
}
- public House2(StructureVillagePieces.Start start, int type, Random rand, StructureBoundingBox p_i45563_4_, EnumFacing facing)
+ public House2(Start start, int type, Random rand, StructureBoundingBox p_i45563_4_, EnumFacing facing)
{
super(start, type);
this.setCoordBaseMode(facing);
this.boundingBox = p_i45563_4_;
}
- public static StructureVillagePieces.House2 createPiece(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_)
+ public static House2 createPiece(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_)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175855_3_, p_175855_4_, p_175855_5_, 0, 0, 0, 10, 6, 7, facing);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175855_1_, structureboundingbox) == null ? new StructureVillagePieces.House2(start, p_175855_7_, rand, structureboundingbox, facing) : null;
+ return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175855_1_, structureboundingbox) == null ? new House2(start, p_175855_7_, rand, structureboundingbox, facing) : null;
}
protected void writeStructureToNBT(NBTTagCompound tagCompound)
@@ -1021,23 +1026,23 @@
}
}
- public static class House3 extends StructureVillagePieces.Village
+ public static class House3 extends Village
{
public House3()
{
}
- public House3(StructureVillagePieces.Start start, int type, Random rand, StructureBoundingBox p_i45561_4_, EnumFacing facing)
+ public House3(Start start, int type, Random rand, StructureBoundingBox p_i45561_4_, EnumFacing facing)
{
super(start, type);
this.setCoordBaseMode(facing);
this.boundingBox = p_i45561_4_;
}
- public static StructureVillagePieces.House3 createPiece(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_)
+ public static House3 createPiece(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_)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175849_3_, p_175849_4_, p_175849_5_, 0, 0, 0, 9, 7, 12, facing);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175849_1_, structureboundingbox) == null ? new StructureVillagePieces.House3(start, p_175849_7_, rand, structureboundingbox, facing) : null;
+ return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175849_1_, structureboundingbox) == null ? new House3(start, p_175849_7_, rand, structureboundingbox, facing) : null;
}
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@@ -1190,7 +1195,7 @@
}
}
- public static class House4Garden extends StructureVillagePieces.Village
+ public static class House4Garden extends Village
{
private boolean isRoofAccessible;
@@ -1198,7 +1203,7 @@
{
}
- public House4Garden(StructureVillagePieces.Start start, int p_i45566_2_, Random rand, StructureBoundingBox p_i45566_4_, EnumFacing facing)
+ public House4Garden(Start start, int p_i45566_2_, Random rand, StructureBoundingBox p_i45566_4_, EnumFacing facing)
{
super(start, p_i45566_2_);
this.setCoordBaseMode(facing);
@@ -1218,10 +1223,10 @@
this.isRoofAccessible = tagCompound.getBoolean("Terrace");
}
- public static StructureVillagePieces.House4Garden createPiece(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_)
+ public static House4Garden createPiece(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_)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175858_3_, p_175858_4_, p_175858_5_, 0, 0, 0, 5, 6, 5, facing);
- return StructureComponent.findIntersecting(p_175858_1_, structureboundingbox) != null ? null : new StructureVillagePieces.House4Garden(start, p_175858_7_, rand, structureboundingbox, facing);
+ return StructureComponent.findIntersecting(p_175858_1_, structureboundingbox) != null ? null : new House4Garden(start, p_175858_7_, rand, structureboundingbox, facing);
}
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@@ -1329,7 +1334,7 @@
}
}
- public static class Path extends StructureVillagePieces.Road
+ public static class Path extends Road
{
private int length;
@@ -1337,7 +1342,7 @@
{
}
- public Path(StructureVillagePieces.Start start, int p_i45562_2_, Random rand, StructureBoundingBox p_i45562_4_, EnumFacing facing)
+ public Path(Start start, int p_i45562_2_, Random rand, StructureBoundingBox p_i45562_4_, EnumFacing facing)
{
super(start, p_i45562_2_);
this.setCoordBaseMode(facing);
@@ -1363,7 +1368,7 @@
for (int i = rand.nextInt(5); i < this.length - 8; i += 2 + rand.nextInt(5))
{
- StructureComponent structurecomponent = this.getNextComponentNN((StructureVillagePieces.Start)componentIn, listIn, rand, 0, i);
+ StructureComponent structurecomponent = this.getNextComponentNN((Start)componentIn, listIn, rand, 0, i);
if (structurecomponent != null)
{
@@ -1374,7 +1379,7 @@
for (int j = rand.nextInt(5); j < this.length - 8; j += 2 + rand.nextInt(5))
{
- StructureComponent structurecomponent1 = this.getNextComponentPP((StructureVillagePieces.Start)componentIn, listIn, rand, 0, j);
+ StructureComponent structurecomponent1 = this.getNextComponentPP((Start)componentIn, listIn, rand, 0, j);
if (structurecomponent1 != null)
{
@@ -1391,16 +1396,16 @@
{
case NORTH:
default:
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.WEST, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.WEST, this.getComponentType());
break;
case SOUTH:
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.WEST, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.WEST, this.getComponentType());
break;
case WEST:
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
break;
case EAST:
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
}
}
@@ -1410,21 +1415,21 @@
{
case NORTH:
default:
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.EAST, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.minZ, EnumFacing.EAST, this.getComponentType());
break;
case SOUTH:
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.EAST, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.minY, this.boundingBox.maxZ - 2, EnumFacing.EAST, this.getComponentType());
break;
case WEST:
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.minX, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
break;
case EAST:
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.maxX - 2, this.boundingBox.minY, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
}
}
}
- public static StructureBoundingBox findPieceBox(StructureVillagePieces.Start start, List<StructureComponent> p_175848_1_, Random rand, int p_175848_3_, int p_175848_4_, int p_175848_5_, EnumFacing facing)
+ public static StructureBoundingBox findPieceBox(Start start, List<StructureComponent> p_175848_1_, Random rand, int p_175848_3_, int p_175848_4_, int p_175848_5_, EnumFacing facing)
{
for (int i = 7 * MathHelper.getInt(rand, 3, 5); i >= 7; i -= 7)
{
@@ -1496,12 +1501,12 @@
public static class PieceWeight
{
- public Class <? extends StructureVillagePieces.Village > villagePieceClass;
+ public Class <? extends Village > villagePieceClass;
public final int villagePieceWeight;
public int villagePiecesSpawned;
public int villagePiecesLimit;
- public PieceWeight(Class <? extends StructureVillagePieces.Village > p_i2098_1_, int p_i2098_2_, int p_i2098_3_)
+ public PieceWeight(Class <? extends Village > p_i2098_1_, int p_i2098_2_, int p_i2098_3_)
{
this.villagePieceClass = p_i2098_1_;
this.villagePieceWeight = p_i2098_2_;
@@ -1519,38 +1524,41 @@
}
}
- public abstract static class Road extends StructureVillagePieces.Village
+ public abstract static class Road extends Village
{
public Road()
{
}
- protected Road(StructureVillagePieces.Start start, int type)
+ protected Road(Start start, int type)
{
super(start, type);
}
}
- public static class Start extends StructureVillagePieces.Well
+ public static class Start extends Well
{
public BiomeProvider biomeProvider;
public int terrainType;
- public StructureVillagePieces.PieceWeight lastPlaced;
- public List<StructureVillagePieces.PieceWeight> structureVillageWeightedPieceList;
+ public PieceWeight lastPlaced;
+ public List<PieceWeight> structureVillageWeightedPieceList;
public List<StructureComponent> pendingHouses = Lists.<StructureComponent>newArrayList();
public List<StructureComponent> pendingRoads = Lists.<StructureComponent>newArrayList();
+ public Biome biome;
public Start()
{
}
- public Start(BiomeProvider biomeProviderIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<StructureVillagePieces.PieceWeight> p_i2104_6_, int p_i2104_7_)
+ public Start(BiomeProvider biomeProviderIn, int p_i2104_2_, Random rand, int p_i2104_4_, int p_i2104_5_, List<PieceWeight> p_i2104_6_, int p_i2104_7_)
{
- super((StructureVillagePieces.Start)null, 0, rand, p_i2104_4_, p_i2104_5_);
+ super((Start)null, 0, rand, p_i2104_4_, p_i2104_5_);
this.biomeProvider = biomeProviderIn;
this.structureVillageWeightedPieceList = p_i2104_6_;
this.terrainType = p_i2104_7_;
Biome biome = biomeProviderIn.getBiome(new BlockPos(p_i2104_4_, 0, p_i2104_5_), Biomes.DEFAULT);
+ this.biome = biome;
+ this.startPiece = this;
if (biome instanceof BiomeDesert)
{
@@ -1570,20 +1578,20 @@
}
}
- public static class Torch extends StructureVillagePieces.Village
+ public static class Torch extends Village
{
public Torch()
{
}
- public Torch(StructureVillagePieces.Start start, int p_i45568_2_, Random rand, StructureBoundingBox p_i45568_4_, EnumFacing facing)
+ public Torch(Start start, int p_i45568_2_, Random rand, StructureBoundingBox p_i45568_4_, EnumFacing facing)
{
super(start, p_i45568_2_);
this.setCoordBaseMode(facing);
this.boundingBox = p_i45568_4_;
}
- public static StructureBoundingBox findPieceBox(StructureVillagePieces.Start start, List<StructureComponent> p_175856_1_, Random rand, int p_175856_3_, int p_175856_4_, int p_175856_5_, EnumFacing facing)
+ public static StructureBoundingBox findPieceBox(Start start, List<StructureComponent> p_175856_1_, Random rand, int p_175856_3_, int p_175856_4_, int p_175856_5_, EnumFacing facing)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175856_3_, p_175856_4_, p_175856_5_, 0, 0, 0, 3, 4, 2, facing);
return StructureComponent.findIntersecting(p_175856_1_, structureboundingbox) != null ? null : structureboundingbox;
@@ -1623,12 +1631,13 @@
private int villagersSpawned;
protected int structureType;
protected boolean isZombieInfested;
+ protected Start startPiece;
public Village()
{
}
- protected Village(StructureVillagePieces.Start start, int type)
+ protected Village(Start start, int type)
{
super(type);
@@ -1636,6 +1645,7 @@
{
this.structureType = start.structureType;
this.isZombieInfested = start.isZombieInfested;
+ startPiece = start;
}
}
@@ -1662,7 +1672,7 @@
}
@Nullable
- protected StructureComponent getNextComponentNN(StructureVillagePieces.Start start, List<StructureComponent> structureComponents, Random rand, int p_74891_4_, int p_74891_5_)
+ protected StructureComponent getNextComponentNN(Start start, List<StructureComponent> structureComponents, Random rand, int p_74891_4_, int p_74891_5_)
{
EnumFacing enumfacing = this.getCoordBaseMode();
@@ -1688,7 +1698,7 @@
}
@Nullable
- protected StructureComponent getNextComponentPP(StructureVillagePieces.Start start, List<StructureComponent> structureComponents, Random rand, int p_74894_4_, int p_74894_5_)
+ protected StructureComponent getNextComponentPP(Start start, List<StructureComponent> structureComponents, Random rand, int p_74894_4_, int p_74894_5_)
{
EnumFacing enumfacing = this.getCoordBaseMode();
@@ -1770,29 +1780,38 @@
EntityZombieVillager entityzombievillager = new EntityZombieVillager(worldIn);
entityzombievillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
entityzombievillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityzombievillager)), (IEntityLivingData)null);
- entityzombievillager.setProfession(this.chooseProfession(i, 0));
+ entityzombievillager.setForgeProfession(this.chooseForgeProfession(i, net.minecraftforge.fml.common.registry.VillagerRegistry.FARMER));
entityzombievillager.enablePersistence();
- worldIn.spawnEntity(entityzombievillager);
+ worldIn.addEntity(entityzombievillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN);
}
else
{
EntityVillager entityvillager = new EntityVillager(worldIn);
entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
- entityvillager.setProfession(this.chooseProfession(i, worldIn.rand.nextInt(6)));
+ net.minecraftforge.fml.common.registry.VillagerRegistry.setRandomProfession(entityvillager, worldIn.rand);
+ entityvillager.setProfession(this.chooseForgeProfession(i, entityvillager.getProfessionForge()));
entityvillager.finalizeMobSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null, false);
- worldIn.spawnEntity(entityvillager);
+ worldIn.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN);
}
}
}
}
+ @Deprecated // Use Forge version below.
protected int chooseProfession(int villagersSpawnedIn, int currentVillagerProfession)
{
return currentVillagerProfession;
}
+ protected net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession chooseForgeProfession(int count, net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession prof)
+ {
+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getById(chooseProfession(count, net.minecraftforge.fml.common.registry.VillagerRegistry.getId(prof)));
+ }
protected IBlockState getBiomeSpecificBlockState(IBlockState blockstateIn)
{
+ net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID event = new net.minecraftforge.event.terraingen.BiomeEvent.GetVillageBlockID(startPiece == null ? null : startPiece.biome, blockstateIn);
+ net.minecraftforge.common.MinecraftForge.TERRAIN_GEN_BUS.post(event);
+ if (event.getResult() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return event.getReplacement();
if (this.structureType == 1)
{
if (blockstateIn.getBlock() == Blocks.LOG || blockstateIn.getBlock() == Blocks.LOG2)
@@ -1919,13 +1938,13 @@
}
}
- public static class Well extends StructureVillagePieces.Village
+ public static class Well extends Village
{
public Well()
{
}
- public Well(StructureVillagePieces.Start start, int type, Random rand, int x, int z)
+ public Well(Start start, int type, Random rand, int x, int z)
{
super(start, type);
this.setCoordBaseMode(EnumFacing.Plane.HORIZONTAL.random(rand));
@@ -1942,10 +1961,10 @@
public void buildComponent(StructureComponent componentIn, List<StructureComponent> listIn, Random rand)
{
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, EnumFacing.WEST, this.getComponentType());
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, EnumFacing.EAST, this.getComponentType());
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
- StructureVillagePieces.generateAndAddRoadPiece((StructureVillagePieces.Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.minX - 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, EnumFacing.WEST, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.maxX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ + 1, EnumFacing.EAST, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.minZ - 1, EnumFacing.NORTH, this.getComponentType());
+ StructureVillagePieces.generateAndAddRoadPiece((Start)componentIn, listIn, rand, this.boundingBox.minX + 1, this.boundingBox.maxY - 4, this.boundingBox.maxZ + 1, EnumFacing.SOUTH, this.getComponentType());
}
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)
@@ -1995,7 +2014,7 @@
}
}
- public static class WoodHut extends StructureVillagePieces.Village
+ public static class WoodHut extends Village
{
private boolean isTallHouse;
private int tablePosition;
@@ -2004,7 +2023,7 @@
{
}
- public WoodHut(StructureVillagePieces.Start start, int type, Random rand, StructureBoundingBox structurebb, EnumFacing facing)
+ public WoodHut(Start start, int type, Random rand, StructureBoundingBox structurebb, EnumFacing facing)
{
super(start, type);
this.setCoordBaseMode(facing);
@@ -2027,10 +2046,10 @@
this.isTallHouse = tagCompound.getBoolean("C");
}
- public static StructureVillagePieces.WoodHut createPiece(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_)
+ public static WoodHut createPiece(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_)
{
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175853_3_, p_175853_4_, p_175853_5_, 0, 0, 0, 4, 6, 5, facing);
- return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new StructureVillagePieces.WoodHut(start, p_175853_7_, rand, structureboundingbox, facing) : null;
+ return canVillageGoDeeper(structureboundingbox) && StructureComponent.findIntersecting(p_175853_1_, structureboundingbox) == null ? new WoodHut(start, p_175853_7_, rand, structureboundingbox, facing) : null;
}
public boolean addComponentParts(World worldIn, Random randomIn, StructureBoundingBox structureBoundingBoxIn)