diff --git a/src/main/java/org/dimdev/dimdoors/mixin/DefaultBiomeFeaturesMixin.java b/src/main/java/org/dimdev/dimdoors/mixin/DefaultBiomeFeaturesMixin.java index 0c77bad3..f01a81ae 100644 --- a/src/main/java/org/dimdev/dimdoors/mixin/DefaultBiomeFeaturesMixin.java +++ b/src/main/java/org/dimdev/dimdoors/mixin/DefaultBiomeFeaturesMixin.java @@ -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); } } diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java b/src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java index 3bf539f5..027f5c08 100644 --- a/src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java +++ b/src/main/java/org/dimdev/dimdoors/world/feature/ModFeatures.java @@ -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 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 SCHEMATIC_GATEWAY_FEATURE = Registry.register(Registry.FEATURE, new Identifier("dimdoors", "schematic_gateway"), new SchematicV2GatewayFeature(SchematicV2GatewayFeatureConfig.CODEC)); + public static final Feature 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)); } } diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/BaseGateway.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/Gateway.java similarity index 59% rename from src/main/java/org/dimdev/dimdoors/world/feature/gateway/BaseGateway.java rename to src/main/java/org/dimdev/dimdoors/world/feature/gateway/Gateway.java index b2900e9b..bb7ef6f3 100644 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/BaseGateway.java +++ b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/Gateway.java @@ -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) { + default boolean isBiomeValid(RegistryKey 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> getBiomes() { + default Set> getBiomes() { return ImmutableSet.of(); } } diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/LimboGateway.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/LimboGateway.java index 35f71af3..c822c450 100644 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/LimboGateway.java +++ b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/LimboGateway.java @@ -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); } } diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/LimboGatewayFeature.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/LimboGatewayFeature.java new file mode 100644 index 00000000..7540f5b6 --- /dev/null +++ b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/LimboGatewayFeature.java @@ -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 { + 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; + } +} diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SandstonePillarsGateway.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SandstonePillarsGateway.java deleted file mode 100644 index 531ff8f7..00000000 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SandstonePillarsGateway.java +++ /dev/null @@ -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> getBiomes() { - return ImmutableSet.of( BiomeKeys.DESERT, BiomeKeys.DESERT_LAKES, BiomeKeys.DESERT_HILLS); - } -} diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGateway.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGateway.java deleted file mode 100644 index 4059d8b8..00000000 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGateway.java +++ /dev/null @@ -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 SCHEMATIC_ID_MAP = HashBiMap.create(); - public static final BiMap 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) { - } -} \ No newline at end of file diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGatewayFeature.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGatewayFeature.java deleted file mode 100644 index b1baf3fd..00000000 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGatewayFeature.java +++ /dev/null @@ -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 { - public SchematicGatewayFeature(Codec 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; - } -} diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGatewayFeatureConfig.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGatewayFeatureConfig.java deleted file mode 100644 index b6fb15b0..00000000 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/SchematicGatewayFeatureConfig.java +++ /dev/null @@ -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 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); - } -} diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/TwoPillarsGateway.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/TwoPillarsGateway.java deleted file mode 100644 index 48835f14..00000000 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/TwoPillarsGateway.java +++ /dev/null @@ -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); - } - } - } - } - } -} diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SandstonePillarsV2Gateway.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SandstonePillarsV2Gateway.java similarity index 89% rename from src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SandstonePillarsV2Gateway.java rename to src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SandstonePillarsV2Gateway.java index f1a67a4b..4c474639 100644 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SandstonePillarsV2Gateway.java +++ b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SandstonePillarsV2Gateway.java @@ -1,4 +1,4 @@ -package org.dimdev.dimdoors.world.feature.gateway.v2; +package org.dimdev.dimdoors.world.feature.gateway.schematic; import java.util.Set; diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2Gateway.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2Gateway.java similarity index 90% rename from src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2Gateway.java rename to src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2Gateway.java index 6e91089a..584e93a6 100644 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2Gateway.java +++ b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2Gateway.java @@ -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); } diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2GatewayFeature.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2GatewayFeature.java similarity index 88% rename from src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2GatewayFeature.java rename to src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2GatewayFeature.java index c8a34dd5..f08a7e0a 100644 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2GatewayFeature.java +++ b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2GatewayFeature.java @@ -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; diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2GatewayFeatureConfig.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2GatewayFeatureConfig.java similarity index 93% rename from src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2GatewayFeatureConfig.java rename to src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2GatewayFeatureConfig.java index a451330f..fafe445b 100644 --- a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/v2/SchematicV2GatewayFeatureConfig.java +++ b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/SchematicV2GatewayFeatureConfig.java @@ -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; diff --git a/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/TwoPillarsV2Gateway.java b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/TwoPillarsV2Gateway.java new file mode 100644 index 00000000..19e420e3 --- /dev/null +++ b/src/main/java/org/dimdev/dimdoors/world/feature/gateway/schematic/TwoPillarsV2Gateway.java @@ -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); +// } +// } +// } +// } +// } +//}