Limbo gateway
Changes to be committed: modified: src/main/java/org/dimdev/dimdoors/mixin/DefaultBiomeFeaturesMixin.java modified: src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java renamed: src/main/java/org/dimdev/dimdoors/world/feature/gateway/BaseGateway.java -> src/main/java/org/dimdev/dimdoors/world/feature/gateway/Gateway.java modified: src/main/java/org/dimdev/dimdoors/world/feature/gateway/LimboGateway.java new file: src/main/java/org/dimdev/dimdoors/world/feature/gateway/LimboGatewayFeature.java deleted: src/main/java/org/dimdev/dimdoors/world/feature/gateway/SandstonePillarsGateway.java deleted: src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGateway.java deleted: src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGatewayFeature.java deleted: src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGatewayFeatureConfig.java deleted: src/main/java/org/dimdev/dimdoors/world/feature/gateway/TwoPillarsGateway.java renamed: src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SandstonePillarsV2Gateway.java -> src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SandstonePillarsV2Gateway.java renamed: src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2Gateway.java -> src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2Gateway.java renamed: src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2GatewayFeature.java -> src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2GatewayFeature.java renamed: src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2GatewayFeatureConfig.java -> src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2GatewayFeatureConfig.java new file: src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/TwoPillarsV2Gateway.java
This commit is contained in:
parent
0b0c4d5d16
commit
b86fa99718
15 changed files with 100 additions and 231 deletions
|
@ -14,6 +14,6 @@ import net.minecraft.world.gen.feature.DefaultBiomeFeatures;
|
|||
public class DefaultBiomeFeaturesMixin {
|
||||
@Inject(method = "addDesertLakes", at = @At("RETURN"))
|
||||
private static void addGateway(GenerationSettings.Builder builder, CallbackInfo ci) {
|
||||
builder.feature(GenerationStep.Feature.TOP_LAYER_MODIFICATION, ModFeatures.SANDSTONE_PILLARS_FEATURE_V2);
|
||||
builder.feature(GenerationStep.Feature.TOP_LAYER_MODIFICATION, ModFeatures.SANDSTONE_PILLARS_FEATURE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,40 @@
|
|||
package org.dimdev.dimdoors.world.feature;
|
||||
|
||||
import org.dimdev.dimdoors.ModConfig;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.v2.SandstonePillarsV2Gateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.v2.SchematicV2Gateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.v2.SchematicV2GatewayFeature;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.v2.SchematicV2GatewayFeatureConfig;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.LimboGatewayFeature;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.schematic.SandstonePillarsV2Gateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.schematic.SchematicV2Gateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.schematic.SchematicV2GatewayFeature;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.schematic.SchematicV2GatewayFeatureConfig;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeatures;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
|
||||
public final class ModFeatures {
|
||||
public static final Feature<SchematicV2GatewayFeatureConfig> GATEWAY_FEATURE_V2 = Registry.register(Registry.FEATURE, new Identifier("dimdoors", "gateway_v2"), new SchematicV2GatewayFeature(SchematicV2GatewayFeatureConfig.CODEC));
|
||||
public static final SchematicV2Gateway SANDSTONE_PILLARS_GATEWAY_V2;
|
||||
public static final ConfiguredFeature<?, ?> SANDSTONE_PILLARS_FEATURE_V2;
|
||||
public static final Feature<SchematicV2GatewayFeatureConfig> SCHEMATIC_GATEWAY_FEATURE = Registry.register(Registry.FEATURE, new Identifier("dimdoors", "schematic_gateway"), new SchematicV2GatewayFeature(SchematicV2GatewayFeatureConfig.CODEC));
|
||||
public static final Feature<DefaultFeatureConfig> LIMBO_GATEWAY_FEATURE = Registry.register(Registry.FEATURE, new Identifier("dimdoors", "limbo_gateway"), new LimboGatewayFeature());
|
||||
public static final SchematicV2Gateway SANDSTONE_PILLARS_GATEWAY = new SandstonePillarsV2Gateway();
|
||||
public static final ConfiguredFeature<?, ?> SANDSTONE_PILLARS_FEATURE;
|
||||
public static final ConfiguredFeature<?, ?> LIMBO_GATEWAY_CONFIGURED_FEATURE;
|
||||
|
||||
public static void init() {
|
||||
SANDSTONE_PILLARS_GATEWAY_V2.init();
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier("dimdoors", "sandstone_pillars_v2"), SANDSTONE_PILLARS_FEATURE_V2);
|
||||
SANDSTONE_PILLARS_GATEWAY.init();
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier("dimdoors", "sandstone_pillars"), SANDSTONE_PILLARS_FEATURE);
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier("dimdoors", "limbo_gateway"), LIMBO_GATEWAY_CONFIGURED_FEATURE);
|
||||
}
|
||||
|
||||
static {
|
||||
SANDSTONE_PILLARS_GATEWAY_V2 = new SandstonePillarsV2Gateway();
|
||||
|
||||
int gatewayChance = FabricLoader.getInstance().isDevelopmentEnvironment() ? 20 : ModConfig.INSTANCE.getWorldConfig().gatewayGenChance;
|
||||
SANDSTONE_PILLARS_FEATURE_V2 = GATEWAY_FEATURE_V2.configure(new SchematicV2GatewayFeatureConfig(SchematicV2Gateway.SCHEMATIC_ID_MAP.get(SANDSTONE_PILLARS_GATEWAY_V2)))
|
||||
SANDSTONE_PILLARS_FEATURE = SCHEMATIC_GATEWAY_FEATURE.configure(new SchematicV2GatewayFeatureConfig(SchematicV2Gateway.SCHEMATIC_ID_MAP.get(SANDSTONE_PILLARS_GATEWAY)))
|
||||
.decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP
|
||||
.applyChance(gatewayChance));
|
||||
LIMBO_GATEWAY_CONFIGURED_FEATURE = LIMBO_GATEWAY_FEATURE.configure(DefaultFeatureConfig.INSTANCE).decorate(ConfiguredFeatures.Decorators.SQUARE_TOP_SOLID_HEIGHTMAP.applyChance(gatewayChance));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,19 +11,18 @@ import net.minecraft.world.StructureWorldAccess;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public abstract class BaseGateway {
|
||||
public void generate(StructureWorldAccess world, int x, int y, int z) {
|
||||
}
|
||||
public interface Gateway {
|
||||
void generate(StructureWorldAccess world, BlockPos pos);
|
||||
|
||||
protected boolean isBiomeValid(RegistryKey<Biome> biome) {
|
||||
default boolean isBiomeValid(RegistryKey<Biome> biome) {
|
||||
return this.getBiomes().contains(biome);
|
||||
}
|
||||
|
||||
public boolean isLocationValid(World world, int x, int y, int z) {
|
||||
return this.isBiomeValid(BuiltinRegistries.BIOME.getKey(world.getBiome(new BlockPos(x, y, z))).orElseThrow(NullPointerException::new));
|
||||
default boolean isLocationValid(World world, BlockPos pos) {
|
||||
return this.isBiomeValid(BuiltinRegistries.BIOME.getKey(world.getBiome(pos)).orElseThrow(NullPointerException::new));
|
||||
}
|
||||
|
||||
public Set<RegistryKey<Biome>> getBiomes() {
|
||||
default Set<RegistryKey<Biome>> getBiomes() {
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
}
|
|
@ -9,30 +9,32 @@ import net.minecraft.util.math.Direction;
|
|||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class LimboGateway extends BaseGateway {
|
||||
public enum LimboGateway implements Gateway {
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, int x, int y, int z) {
|
||||
public void generate(StructureWorldAccess world, BlockPos pos) {
|
||||
BlockState unravelledFabric = ModBlocks.UNRAVELLED_FABRIC.getDefaultState();
|
||||
// Build the gateway out of Unraveled Fabric. Since nearly all the blocks in Limbo are of
|
||||
// that type, there is no point replacing the ground.
|
||||
world.setBlockState(new BlockPos(x, y + 3, z + 1), unravelledFabric, 2);
|
||||
world.setBlockState(new BlockPos(x, y + 3, z - 1), unravelledFabric, 2);
|
||||
world.setBlockState(pos.add(0, 3, 1), unravelledFabric, 2);
|
||||
world.setBlockState(pos.add(0, 3, -1), unravelledFabric, 2);
|
||||
|
||||
// Build the columns around the door
|
||||
world.setBlockState(new BlockPos(x, y + 2, z - 1), unravelledFabric, 2);
|
||||
world.setBlockState(new BlockPos(x, y + 2, z + 1), unravelledFabric, 2);
|
||||
world.setBlockState(new BlockPos(x, y + 1, z - 1), unravelledFabric, 2);
|
||||
world.setBlockState(new BlockPos(x, y + 1, z + 1), unravelledFabric, 2);
|
||||
world.setBlockState(pos.add(0, 2, -1), unravelledFabric, 2);
|
||||
world.setBlockState(pos.add(0, 2, 1), unravelledFabric, 2);
|
||||
world.setBlockState(pos.add(0, 1, 1), unravelledFabric, 2);
|
||||
world.setBlockState(pos.add(0, 1, 1), unravelledFabric, 2);
|
||||
|
||||
this.placePortal(world, new BlockPos(x, y + 1, z), Direction.NORTH);
|
||||
this.placePortal(world, pos.add(0, 1, 0), Direction.NORTH);
|
||||
}
|
||||
|
||||
private void placePortal(StructureWorldAccess world, BlockPos pos, Direction facing) {
|
||||
// todo
|
||||
world.setBlockState(pos, ModBlocks.DIMENSIONAL_PORTAL.getDefaultState(), 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocationValid(World world, int x, int y, int z) {
|
||||
public boolean isLocationValid(World world, BlockPos pos) {
|
||||
return ModDimensions.isLimboDimension(world);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
|
||||
public class LimboGatewayFeature extends Feature<DefaultFeatureConfig> {
|
||||
public LimboGatewayFeature() {
|
||||
super(DefaultFeatureConfig.CODEC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig featureConfig) {
|
||||
LimboGateway.INSTANCE.generate(world, pos);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.BiomeKeys;
|
||||
|
||||
public class SandstonePillarsGateway extends SchematicGateway {
|
||||
public SandstonePillarsGateway() {
|
||||
super("sandstone_pillars");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RegistryKey<Biome>> getBiomes() {
|
||||
return ImmutableSet.of( BiomeKeys.DESERT, BiomeKeys.DESERT_LAKES, BiomeKeys.DESERT_HILLS);
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dimdev.dimcore.schematic.Schematic;
|
||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
|
||||
public abstract class SchematicGateway extends BaseGateway {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private Schematic schematic;
|
||||
public static final BiMap<SchematicGateway, String> SCHEMATIC_ID_MAP = HashBiMap.create();
|
||||
public static final BiMap<String, SchematicGateway> ID_SCHEMATIC_MAP = HashBiMap.create();
|
||||
|
||||
public SchematicGateway(String id) {
|
||||
String schematicJarDirectory = "/data/dimdoors/gateways/";
|
||||
SCHEMATIC_ID_MAP.putIfAbsent(this, id);
|
||||
ID_SCHEMATIC_MAP.putIfAbsent(id, this);
|
||||
|
||||
//Initialising the possible locations/formats for the schematic file
|
||||
InputStream schematicStream = DimensionalDoorsInitializer.class.getResourceAsStream(schematicJarDirectory + id + ".schem");
|
||||
|
||||
//determine which location to load the schematic file from (and what format)
|
||||
DataInputStream schematicDataStream = null;
|
||||
boolean streamOpened = false;
|
||||
if (schematicStream != null) {
|
||||
schematicDataStream = new DataInputStream(schematicStream);
|
||||
streamOpened = true;
|
||||
} else {
|
||||
LOGGER.warn("Schematic '" + id + "' was not found in the jar or config directory, neither with the .schem extension, nor with the .schematic extension.");
|
||||
}
|
||||
|
||||
CompoundTag schematicNBT;
|
||||
this.schematic = null;
|
||||
if (streamOpened) {
|
||||
try {
|
||||
schematicNBT = NbtIo.readCompressed(schematicDataStream);
|
||||
this.schematic = Schematic.fromTag(schematicNBT);
|
||||
//PocketTemplate.replacePlaceholders(schematic);
|
||||
schematicDataStream.close();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.error("Schematic file for " + id + " could not be read as a valid schematic NBT file.", ex);
|
||||
} finally {
|
||||
try {
|
||||
schematicDataStream.close();
|
||||
} catch (IOException ex) {
|
||||
LOGGER.error("Error occured while closing schematicDataStream", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, int x, int y, int z) {
|
||||
this.schematic.place(world, x, y, z);
|
||||
this.generateRandomBits(world, x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
protected void generateRandomBits(StructureWorldAccess world, int x, int y, int z) {
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
|
||||
import net.minecraft.block.AirBlock;
|
||||
import net.minecraft.block.FallingBlock;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
import net.minecraft.world.gen.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.gen.feature.Feature;
|
||||
|
||||
public class SchematicGatewayFeature extends Feature<SchematicGatewayFeatureConfig> {
|
||||
public SchematicGatewayFeature(Codec<SchematicGatewayFeatureConfig> codec) {
|
||||
super(codec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, SchematicGatewayFeatureConfig config) {
|
||||
if (world.getBlockState(blockPos).getBlock() instanceof AirBlock && world.getBlockState(blockPos.down()).getBlock() instanceof FallingBlock) {
|
||||
config.getGateway().generate(world, blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
|
||||
import net.minecraft.world.gen.feature.FeatureConfig;
|
||||
|
||||
public class SchematicGatewayFeatureConfig implements FeatureConfig {
|
||||
public static final Codec<SchematicGatewayFeatureConfig> CODEC = RecordCodecBuilder.create((instance) -> {
|
||||
return instance.group(Codec.STRING.fieldOf("id").forGetter((config) -> {
|
||||
return config.gatewayId;
|
||||
})).apply(instance, SchematicGatewayFeatureConfig::new);
|
||||
});
|
||||
private final SchematicGateway gateway;
|
||||
private final String gatewayId;
|
||||
|
||||
public SchematicGateway getGateway() {
|
||||
return this.gateway;
|
||||
}
|
||||
|
||||
public SchematicGatewayFeatureConfig(String gatewayId) {
|
||||
this.gatewayId = gatewayId;
|
||||
this.gateway = SchematicGateway.ID_SCHEMATIC_MAP.get(gatewayId);
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
|
||||
public class TwoPillarsGateway extends SchematicGateway {
|
||||
private static final int GATEWAY_RADIUS = 4;
|
||||
|
||||
public TwoPillarsGateway() {
|
||||
super("two_pillars");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateRandomBits(StructureWorldAccess world, int x, int y, int z) {
|
||||
//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(new BlockPos(x + xc, y - 1, z + 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(new BlockPos(x + xc, y, z + zc), Blocks.STONE_BRICKS.getDefaultState(), 2);
|
||||
} else if (i < world.getRandom().nextInt(3) + 3) {
|
||||
//Place Cracked Stone Bricks
|
||||
world.setBlockState(new BlockPos(x + xc, y, z + zc), Blocks.CRACKED_STONE_BRICKS.getDefaultState(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway.v2;
|
||||
package org.dimdev.dimdoors.world.feature.gateway.schematic;
|
||||
|
||||
import java.util.Set;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway.v2;
|
||||
package org.dimdev.dimdoors.world.feature.gateway.schematic;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -9,7 +9,7 @@ import org.apache.logging.log4j.Logger;
|
|||
import org.dimdev.dimcore.schematic.v2.Schematic;
|
||||
import org.dimdev.dimcore.schematic.v2.SchematicPlacer;
|
||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.BaseGateway;
|
||||
import org.dimdev.dimdoors.world.feature.gateway.Gateway;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
|
@ -18,7 +18,7 @@ import net.minecraft.nbt.NbtIo;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
|
||||
public class SchematicV2Gateway extends BaseGateway {
|
||||
public class SchematicV2Gateway implements Gateway {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private Schematic schematic;
|
||||
private final String id;
|
||||
|
@ -63,11 +63,6 @@ public class SchematicV2Gateway extends BaseGateway {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(StructureWorldAccess world, int x, int y, int z) {
|
||||
SchematicPlacer.place(this.schematic, world, new BlockPos(x, y, z));
|
||||
}
|
||||
|
||||
public void generate(StructureWorldAccess world, BlockPos pos) {
|
||||
SchematicPlacer.place(this.schematic, world, pos);
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway.v2;
|
||||
package org.dimdev.dimdoors.world.feature.gateway.schematic;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.dimdev.dimdoors.world.feature.gateway.SchematicGatewayFeatureConfig;
|
||||
import com.mojang.serialization.Codec;
|
||||
|
||||
import net.minecraft.block.AirBlock;
|
|
@ -1,4 +1,4 @@
|
|||
package org.dimdev.dimdoors.world.feature.gateway.v2;
|
||||
package org.dimdev.dimdoors.world.feature.gateway.schematic;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|
@ -0,0 +1,37 @@
|
|||
//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);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
Loading…
Reference in a new issue