Added some more structures

This commit is contained in:
Sollace 2019-02-21 12:36:07 +02:00
parent 672f78d35e
commit 31dddf73a3
6 changed files with 17 additions and 14 deletions

View file

@ -13,8 +13,11 @@ import net.minecraft.world.gen.structure.template.TemplateManager;
public class CloudDungeon extends TemplateBasedFeature { public class CloudDungeon extends TemplateBasedFeature {
private static final ResourceLocation TEMPLE = new ResourceLocation(Unicopia.MODID, "cloud/temple_small"); private static final ResourceLocation[] VARIANTS = new ResourceLocation[] {
private static final ResourceLocation HOUSE = new ResourceLocation(Unicopia.MODID, "cloud/house_small"); new ResourceLocation(Unicopia.MODID, "cloud/temple_small"),
new ResourceLocation(Unicopia.MODID, "cloud/house_small"),
new ResourceLocation(Unicopia.MODID, "cloud/island_small")
};
public CloudDungeon() { public CloudDungeon() {
} }
@ -26,11 +29,9 @@ public class CloudDungeon extends TemplateBasedFeature {
@Override @Override
public boolean addComponentParts(World world, BlockPos startPos, TemplateManager templates, PlacementSettings placement) { public boolean addComponentParts(World world, BlockPos startPos, TemplateManager templates, PlacementSettings placement) {
if (world.rand.nextBoolean()) { int index = world.rand.nextInt(VARIANTS.length);
applyTemplate(world, startPos, templates, placement, TEMPLE);
} else { applyTemplate(world, startPos, templates, placement, VARIANTS[index]);
applyTemplate(world, startPos, templates, placement, HOUSE);
}
return true; return true;
} }

View file

@ -12,8 +12,12 @@ import net.minecraft.world.gen.structure.template.TemplateManager;
public class GroundDungeon extends TemplateBasedFeature { public class GroundDungeon extends TemplateBasedFeature {
private static final ResourceLocation TOWER = new ResourceLocation(Unicopia.MODID, "ground/tower"); private static final ResourceLocation[] VARIANTS = new ResourceLocation[] {
private static final ResourceLocation TEMPLE_1 = new ResourceLocation(Unicopia.MODID, "ground/temple_with_book"); new ResourceLocation(Unicopia.MODID, "ground/tower"),
new ResourceLocation(Unicopia.MODID, "ground/temple_with_book"),
new ResourceLocation(Unicopia.MODID, "ground/temple_without_book"),
new ResourceLocation(Unicopia.MODID, "ground/wizard_tower_red")
};
public GroundDungeon() { public GroundDungeon() {
} }
@ -25,11 +29,9 @@ public class GroundDungeon extends TemplateBasedFeature {
@Override @Override
public boolean addComponentParts(World world, BlockPos startPos, TemplateManager templates, PlacementSettings placement) { public boolean addComponentParts(World world, BlockPos startPos, TemplateManager templates, PlacementSettings placement) {
if (world.rand.nextBoolean()) { int index = world.rand.nextInt(VARIANTS.length);
applyTemplate(world, startPos, templates, placement, TOWER);
} else { applyTemplate(world, startPos, templates, placement, VARIANTS[index]);
applyTemplate(world, startPos, templates, placement, TEMPLE_1);
}
return true; return true;
} }