Added Two pillars

Changes to be committed:
	modified:   src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2Gateway.java
	modified:   src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/TwoPillarsV2Gateway.java
	modified:   src/main/resources/data/dimdoors/advancements/dimdoor/root.json
	new file:   src/main/resources/data/dimdoors/gateways/v2/two_pillars.schem
This commit is contained in:
SD 2020-10-06 16:48:02 +05:30
parent 8ec8e73da7
commit 889b245dd6
No known key found for this signature in database
GPG key ID: E36B57EE08544BC5
4 changed files with 54 additions and 42 deletions

View file

@ -63,17 +63,16 @@ public abstract class SchematicV2Gateway implements Gateway {
}
}
public void generate(StructureWorldAccess world, BlockPos pos) {
public final void generate(StructureWorldAccess world, BlockPos pos) {
SchematicPlacer.place(this.schematic, world, pos);
this.generateRandomBits(world, pos);
}
/**
* Generates randomized portions of the gateway structure (e.g. rubble, foliage)
*
* @param world - the world in which to generate the gateway
* @param x - the x-coordinate at which to center the gateway; usually where the door is placed
* @param y - the y-coordinate of the block on which the gateway may be built
* @param z - the z-coordinate at which to center the gateway; usually where the door is placed
* @param pos - the position at which the schematic is placed
*/
protected void generateRandomBits(StructureWorldAccess world, BlockPos pos) {
}

View file

@ -1,37 +1,50 @@
//package org.dimdev.dimdoors.world.feature.gateway.v2;
//
//import net.minecraft.block.Blocks;
//import net.minecraft.util.math.BlockPos;
//import net.minecraft.world.StructureWorldAccess;
//
//public class TwoPillarsV2Gateway extends SchematicGateway {
// private static final int GATEWAY_RADIUS = 4;
//
// public TwoPillarsV2Gateway() {
// super("two_pillars");
// }
//
// @Override
// protected void generateRandomBits(StructureWorldAccess world, BlockPos pos) {
// //Replace some of the ground around the gateway with bricks
// for (int xc = -GATEWAY_RADIUS; xc <= GATEWAY_RADIUS; xc++) {
// for (int zc = -GATEWAY_RADIUS; zc <= GATEWAY_RADIUS; zc++) {
// //Check that the block is supported by an opaque block.
// //This prevents us from building over a cliff, on the peak of a mountain,
// //or the surface of the ocean or a frozen lake.
// if (world.getBlockState(pos.add(xc, -1, zc)).getMaterial().isSolid()) {
// //Randomly choose whether to place bricks or not. The math is designed so that the
// //chances of placing a block decrease as we get farther from the gateway's center.
// int i = Math.abs(xc) + Math.abs(zc);
// if (i < world.getRandom().nextInt(2) + 3) {
// //Place Stone Bricks
// world.setBlockState(pos.add(xc, 0, zc), Blocks.STONE_BRICKS.getDefaultState(), 2);
// } else if (i < world.getRandom().nextInt(3) + 3) {
// //Place Cracked Stone Bricks
// world.setBlockState(pos.add(xc, 0, zc), Blocks.CRACKED_STONE_BRICKS.getDefaultState(), 2);
// }
// }
// }
// }
// }
//}
package org.dimdev.dimdoors.world.feature.gateway.schematic;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.dimdev.dimdoors.mixin.BuiltinBiomesAccessor;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.biome.Biome;
public class TwoPillarsV2Gateway extends SchematicV2Gateway {
private static final int GATEWAY_RADIUS = 4;
public TwoPillarsV2Gateway() {
super("two_pillars");
}
@Override
protected void generateRandomBits(StructureWorldAccess world, BlockPos pos) {
//Replace some of the ground around the gateway with bricks
for (int xc = -GATEWAY_RADIUS; xc <= GATEWAY_RADIUS; xc++) {
for (int zc = -GATEWAY_RADIUS; zc <= GATEWAY_RADIUS; zc++) {
//Check that the block is supported by an opaque block.
//This prevents us from building over a cliff, on the peak of a mountain,
//or the surface of the ocean or a frozen lake.
if (world.getBlockState(pos.add(xc, -1, zc)).getMaterial().isSolid()) {
//Randomly choose whether to place bricks or not. The math is designed so that the
//chances of placing a block decrease as we get farther from the gateway's center.
int i = Math.abs(xc) + Math.abs(zc);
if (i < world.getRandom().nextInt(2) + 3) {
//Place Stone Bricks
world.setBlockState(pos.add(xc, 0, zc), Blocks.STONE_BRICKS.getDefaultState(), 2);
} else if (i < world.getRandom().nextInt(3) + 3) {
//Place Cracked Stone Bricks
world.setBlockState(pos.add(xc, 0, zc), Blocks.CRACKED_STONE_BRICKS.getDefaultState(), 2);
}
}
}
}
}
@Override
public Set<RegistryKey<Biome>> getBiomes() {
return BuiltinBiomesAccessor.getIdMap().int2ObjectEntrySet().stream().map(Map.Entry::getValue).collect(Collectors.toSet());
}
}