diff --git a/common/src/main/java/generations/gg/generations/structures/generationsstructures/processors/structure_processors/shrines/fiery/FieryShrineRandomizerProcessor.java b/common/src/main/java/generations/gg/generations/structures/generationsstructures/processors/structure_processors/shrines/fiery/FieryShrineRandomizerProcessor.java index 6b00a61..94abc37 100644 --- a/common/src/main/java/generations/gg/generations/structures/generationsstructures/processors/structure_processors/shrines/fiery/FieryShrineRandomizerProcessor.java +++ b/common/src/main/java/generations/gg/generations/structures/generationsstructures/processors/structure_processors/shrines/fiery/FieryShrineRandomizerProcessor.java @@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorType; @@ -13,6 +14,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Random; + public class FieryShrineRandomizerProcessor extends StructureProcessor { public static final FieryShrineRandomizerProcessor INSTANCE = new FieryShrineRandomizerProcessor(); @@ -23,12 +26,48 @@ public class FieryShrineRandomizerProcessor extends StructureProcessor { public StructureTemplate.StructureBlockInfo processBlock(@NotNull LevelReader level, @NotNull BlockPos blockPos, @NotNull BlockPos pos, StructureTemplate.@NotNull StructureBlockInfo blockInfo, StructureTemplate.@NotNull StructureBlockInfo relativeBlockInfo, @NotNull StructurePlaceSettings settings) { Block block = relativeBlockInfo.state().getBlock(); if (GenerationsStructures.CONFIG.randomization.randomizeFieryShrineBlocks) - return relativeBlockInfo; + if (block == Blocks.POLISHED_BLACKSTONE || block == Blocks.POLISHED_BLACKSTONE_BRICKS || block == Blocks.BLACKSTONE || block == Blocks.GILDED_BLACKSTONE) + return new StructureTemplate.StructureBlockInfo(relativeBlockInfo.pos(), randomizeBaseBlocks(block).defaultBlockState(), relativeBlockInfo.nbt()); + else if (block == Blocks.NETHER_BRICKS || block == Blocks.CRACKED_NETHER_BRICKS) + return new StructureTemplate.StructureBlockInfo(relativeBlockInfo.pos(), randomizeNetherBricks(block).defaultBlockState(), relativeBlockInfo.nbt()); return relativeBlockInfo; } + private Block randomizeBaseBlocks(Block block) { + switch (new Random().nextInt(5)) { + case 0 -> { + return Blocks.POLISHED_BLACKSTONE; + } + case 1 -> { + return Blocks.POLISHED_BLACKSTONE_BRICKS; + } + case 2 -> { + return Blocks.BLACKSTONE; + } + case 3 -> { + return Blocks.GILDED_BLACKSTONE; + } + default -> { + return block; + } + } + } + + private Block randomizeNetherBricks(Block block) { + switch (new Random().nextInt(2)) { + case 0 -> { + return Blocks.NETHER_BRICKS; + } + case 1 -> { + return Blocks.CRACKED_NETHER_BRICKS; + } + default -> { + return block; + } + } + } @Override protected @NotNull StructureProcessorType getType() { diff --git a/common/src/main/java/generations/gg/generations/structures/generationsstructures/processors/structure_processors/shrines/staticShrine/StaticShrineRandomizerProcessor.java b/common/src/main/java/generations/gg/generations/structures/generationsstructures/processors/structure_processors/shrines/staticShrine/StaticShrineRandomizerProcessor.java index f629ab0..a8eb872 100644 --- a/common/src/main/java/generations/gg/generations/structures/generationsstructures/processors/structure_processors/shrines/staticShrine/StaticShrineRandomizerProcessor.java +++ b/common/src/main/java/generations/gg/generations/structures/generationsstructures/processors/structure_processors/shrines/staticShrine/StaticShrineRandomizerProcessor.java @@ -1,11 +1,9 @@ package generations.gg.generations.structures.generationsstructures.processors.structure_processors.shrines.staticShrine; import com.mojang.serialization.Codec; -import generations.gg.generations.structures.generationsstructures.GenerationsStructures; import generations.gg.generations.structures.generationsstructures.processors.StructureProcessors; import net.minecraft.core.BlockPos; import net.minecraft.world.level.LevelReader; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessor; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorType; @@ -22,14 +20,14 @@ public class StaticShrineRandomizerProcessor extends StructureProcessor { @Nullable @Override public StructureTemplate.StructureBlockInfo processBlock(@NotNull LevelReader level, @NotNull BlockPos blockPos, @NotNull BlockPos pos, StructureTemplate.@NotNull StructureBlockInfo blockInfo, StructureTemplate.@NotNull StructureBlockInfo relativeBlockInfo, @NotNull StructurePlaceSettings settings) { - Block block = relativeBlockInfo.state().getBlock(); - if (GenerationsStructures.CONFIG.randomization.randomizeStaticShrineBlocks) - return relativeBlockInfo; - + // Block block = relativeBlockInfo.state().getBlock(); + // if (GenerationsStructures.CONFIG.randomization.randomizeStaticShrineBlocks) return relativeBlockInfo; } + + @Override protected @NotNull StructureProcessorType getType() { return StructureProcessors.STATIC_SHRINE_RANDOMIZER_PROCESSOR;