diff --git a/common/src/main/java/net/cjsah/skyland/SkylandConfig.java b/common/src/main/java/net/cjsah/skyland/SkylandConfig.java index 85fcf87..f3bbe45 100644 --- a/common/src/main/java/net/cjsah/skyland/SkylandConfig.java +++ b/common/src/main/java/net/cjsah/skyland/SkylandConfig.java @@ -1,5 +1,6 @@ package net.cjsah.skyland; public class SkylandConfig { - public static boolean GenSliverFishSpawner = true; + public static final boolean GenSliverFishSpawner = true; // 要塞末地传送门生成蠹虫刷怪笼 + public static final boolean genFirstEndSpike = true; // 末地首次生成黑曜石柱 } diff --git a/common/src/main/java/net/cjsah/skyland/event/SkylandChunkGenerateEvent.java b/common/src/main/java/net/cjsah/skyland/event/SkylandChunkGenerateEvent.java index 1cd8b72..36ab678 100644 --- a/common/src/main/java/net/cjsah/skyland/event/SkylandChunkGenerateEvent.java +++ b/common/src/main/java/net/cjsah/skyland/event/SkylandChunkGenerateEvent.java @@ -7,16 +7,9 @@ import net.minecraft.world.level.levelgen.RandomState; @Getter -public class SkylandChunkGenerateEvent { - private final WorldGenRegion level; - private final StructureManager structureManager; - private final RandomState random; - private final ChunkAccess chunk; - - public SkylandChunkGenerateEvent(WorldGenRegion level, StructureManager structureManager, RandomState random, ChunkAccess chunk) { - this.level = level; - this.structureManager = structureManager; - this.random = random; - this.chunk = chunk; - } -} +public record SkylandChunkGenerateEvent( + WorldGenRegion level, + StructureManager structureManager, + RandomState random, + ChunkAccess chunk +) {} diff --git a/common/src/main/java/net/cjsah/skyland/generator/SkylandChunkGenerator.java b/common/src/main/java/net/cjsah/skyland/generator/SkylandChunkGenerator.java index b2a65d5..a4948bf 100644 --- a/common/src/main/java/net/cjsah/skyland/generator/SkylandChunkGenerator.java +++ b/common/src/main/java/net/cjsah/skyland/generator/SkylandChunkGenerator.java @@ -8,6 +8,7 @@ import it.unimi.dsi.fastutil.objects.ObjectLists; import lombok.Getter; import net.cjsah.skyland.Skyland; +import net.cjsah.skyland.SkylandConfig; import net.cjsah.skyland.event.SkylandChunkGenerateEvent; import net.cjsah.skyland.mixin.ChunkGeneratorAccessor; import net.cjsah.skyland.mixin.NoiseChunkAccessor; @@ -47,8 +48,6 @@ import net.minecraft.world.level.levelgen.structure.pools.JigsawJunction; import net.minecraft.world.level.levelgen.structure.structures.StrongholdStructure; import org.jetbrains.annotations.NotNull; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.Arrays; import java.util.Collections; @@ -68,7 +67,6 @@ public class SkylandChunkGenerator extends ChunkGenerator { ).apply(instance, instance.stable(SkylandChunkGenerator::new)) ); private static final BlockState AIR = Blocks.AIR.defaultBlockState(); - private static final Logger log = LoggerFactory.getLogger(SkylandChunkGenerator.class); @Getter private final Holder settings; @@ -217,7 +215,7 @@ public void applyBiomeDecoration(WorldGenLevel level, ChunkAccess chunkAccess, S if (feature.feature().is(new ResourceLocation("end_gateway_return"))) { level.setCurrentlyGenerating(supplier); feature.placeWithBiomeCheck(level, this, random, blockPos); - } else if (feature.feature().is(new ResourceLocation("end_spike"))) { + } else if (SkylandConfig.genFirstEndSpike && feature.feature().is(new ResourceLocation("end_spike"))) { level.setCurrentlyGenerating(supplier); feature.placeWithBiomeCheck(level, this, random, blockPos); } diff --git a/common/src/main/java/net/cjsah/skyland/generator/SkylandStructures.java b/common/src/main/java/net/cjsah/skyland/generator/SkylandStructures.java index 112342d..60e59ef 100644 --- a/common/src/main/java/net/cjsah/skyland/generator/SkylandStructures.java +++ b/common/src/main/java/net/cjsah/skyland/generator/SkylandStructures.java @@ -7,19 +7,17 @@ import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.Rotation; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.SpawnerBlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.structure.BoundingBox; import net.minecraft.world.level.levelgen.structure.StructurePiece; import java.util.Objects; import java.util.function.Consumer; -import java.util.function.Supplier; public abstract class SkylandStructures { protected final StructurePiece piece; - protected Rotation rotation; - protected Mirror mirror; + protected final Rotation rotation; + protected final Mirror mirror; @SuppressWarnings("DataFlowIssue") public SkylandStructures(StructurePiece piece) { diff --git a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/AnvilcraftIntegration.java b/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/AnvilcraftIntegration.java index 6ba54fc..77e601a 100644 --- a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/AnvilcraftIntegration.java +++ b/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/AnvilcraftIntegration.java @@ -5,7 +5,6 @@ import dev.architectury.injectables.annotations.ExpectPlatform; import dev.dubhe.anvilcraft.api.registry.AnvilCraftRegistrate; import net.cjsah.skyland.Skyland; -import net.cjsah.skyland.integration.anvilcraft.event.SkylandChunkGenerateEventListener; import net.cjsah.skyland.integration.anvilcraft.init.AnvilCraftBlocks; import net.cjsah.skyland.integration.anvilcraft.init.AnvilCraftItemGroups; import net.cjsah.skyland.integration.anvilcraft.init.AnvilCraftItems; @@ -33,7 +32,6 @@ public void apply() { AnvilCraftBlocks.register(); AnvilCraftItems.register(); AnvilCraftItemGroups.register(); - Skyland.EVENT_BUS.register(new SkylandChunkGenerateEventListener()); REGISTRATE.register(); AnvilcraftIntegration.init(); } diff --git a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/event/SkylandChunkGenerateEventListener.java b/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/event/SkylandChunkGenerateEventListener.java deleted file mode 100644 index 93a4e57..0000000 --- a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/event/SkylandChunkGenerateEventListener.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.cjsah.skyland.integration.anvilcraft.event; - -import dev.anvilcraft.lib.event.SubscribeEvent; -import net.cjsah.skyland.event.SkylandChunkGenerateEvent; -import net.cjsah.skyland.integration.anvilcraft.feature.LandFeature; -import net.minecraft.core.BlockPos; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.WorldGenRegion; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.storage.LevelData; -import org.jetbrains.annotations.NotNull; - -public class SkylandChunkGenerateEventListener { - @SuppressWarnings("deprecation") - @SubscribeEvent - public void generate(@NotNull SkylandChunkGenerateEvent event) { -// WorldGenRegion level = event.getLevel(); -// ServerLevel serverLevel = event.getLevel().getLevel(); -// if (serverLevel.dimension() != ServerLevel.OVERWORLD) return; -// BlockPos spawnPos = new BlockPos(8, 64, 8); -// LevelData levelData = level.getLevelData(); -// ChunkPos pos = event.getChunk().getPos(); -// if (pos.x == levelData.getXSpawn() && pos.z == levelData.getYSpawn()) { -// serverLevel.setDefaultSpawnPos(spawnPos, 0.0f); -// } -// if (pos.x != 0 || pos.z != 0) return; -// LandFeature.place(level, spawnPos); - } -} diff --git a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/feature/LandFeature.java b/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/feature/LandFeature.java deleted file mode 100644 index 6b789bc..0000000 --- a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/feature/LandFeature.java +++ /dev/null @@ -1,23 +0,0 @@ -package net.cjsah.skyland.integration.anvilcraft.feature; - -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.block.Blocks; - -public class LandFeature { - public static void place(LevelAccessor level, BlockPos pos) { - for (int x = -1; x <= 1; x++) { - for (int z = -1; z <= 1; z++) { - level.setBlock(pos.offset(new BlockPos(x, -3, z)), Blocks.BEDROCK.defaultBlockState(), 3); - } - } - for (int x = -1; x <= 1; x++) { - for (int z = -1; z <= 1; z++) { - level.setBlock(pos.offset(new BlockPos(x, -2, z)), Blocks.DIRT.defaultBlockState(), 3); - level.setBlock(pos.offset(new BlockPos(x, -1, z)), Blocks.DIRT.defaultBlockState(), 3); - } - } - level.setBlock(pos.offset(new BlockPos(0, -2, 0)), Blocks.BUDDING_AMETHYST.defaultBlockState(), 3); - level.setBlock(pos.offset(new BlockPos(0, 0, 0)), Blocks.BAMBOO_SAPLING.defaultBlockState(), 3); - } -} diff --git a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/init/AnvilCraftBlocks.java b/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/init/AnvilCraftBlocks.java index b48799a..bd03266 100644 --- a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/init/AnvilCraftBlocks.java +++ b/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/init/AnvilCraftBlocks.java @@ -1,10 +1,7 @@ package net.cjsah.skyland.integration.anvilcraft.init; import dev.architectury.injectables.annotations.ExpectPlatform; -import net.cjsah.skyland.Skyland; import net.cjsah.skyland.integration.anvilcraft.block.StoneAnvilBlock; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockBehaviour; diff --git a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/init/AnvilCraftItems.java b/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/init/AnvilCraftItems.java index 496c1d2..bd9eb8d 100644 --- a/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/init/AnvilCraftItems.java +++ b/common/src/main/java/net/cjsah/skyland/integration/anvilcraft/init/AnvilCraftItems.java @@ -1,9 +1,6 @@ package net.cjsah.skyland.integration.anvilcraft.init; import dev.architectury.injectables.annotations.ExpectPlatform; -import net.cjsah.skyland.Skyland; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.Item;