diff --git a/CHANGELOG.md b/CHANGELOG.md index 85b4b14..abfd229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +**1.0.8** +* Fix Lakes Cutting Off Time Temples + **1.0.7** * Tweak Crafting Slightly diff --git a/gradle.properties b/gradle.properties index 3b6e68f..e764c91 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G fabric_loader_version = 0.7.10+build.191 # Mod Properties - mod_version = 1.0.7 + mod_version = 1.0.8 maven_group = com.thebrokenrail archives_base_name = reliccraft diff --git a/src/main/java/com/thebrokenrail/reliccraft/mixin/MixinLakeFeature.java b/src/main/java/com/thebrokenrail/reliccraft/mixin/MixinLakeFeature.java new file mode 100644 index 0000000..2e3a0fe --- /dev/null +++ b/src/main/java/com/thebrokenrail/reliccraft/mixin/MixinLakeFeature.java @@ -0,0 +1,43 @@ +package com.thebrokenrail.reliccraft.mixin; + +import com.thebrokenrail.reliccraft.RelicCraft; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IWorld; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.gen.chunk.ChunkGenerator; +import net.minecraft.world.gen.chunk.ChunkGeneratorConfig; +import net.minecraft.world.gen.feature.LakeFeature; +import net.minecraft.world.gen.feature.SingleStateFeatureConfig; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +@SuppressWarnings("unused") +@Mixin(LakeFeature.class) +public class MixinLakeFeature { + @Inject(at = @At("HEAD"), method = "generate", cancellable = true) + public void fixTimeTemple(IWorld world, ChunkGenerator chunkGenerator, Random random, BlockPos blockPos, SingleStateFeatureConfig singleStateFeatureConfig, CallbackInfoReturnable info) { + List chunksToScan = new ArrayList<>(); + chunksToScan.add(world.getChunk(blockPos)); + chunksToScan.add(world.getChunk(blockPos.add(16, 0, 16))); + chunksToScan.add(world.getChunk(blockPos.add(-16, 0, -16))); + chunksToScan.add(world.getChunk(blockPos.add(0, 0, 16))); + chunksToScan.add(world.getChunk(blockPos.add(16, 0, 0))); + chunksToScan.add(world.getChunk(blockPos.add(-16, 0, 0))); + chunksToScan.add(world.getChunk(blockPos.add(0, 0, -16))); + chunksToScan.add(world.getChunk(blockPos.add(16, 0, -16))); + chunksToScan.add(world.getChunk(blockPos.add(-16, 0, 16))); + + for (Chunk chunk : chunksToScan) { + if (!chunk.getStructureReferences(RelicCraft.TIME_TEMPLE_ID).isEmpty()) { + info.setReturnValue(false); + break; + } + } + } +} diff --git a/src/main/resources/reliccraft.mixins.json b/src/main/resources/reliccraft.mixins.json index e82682a..26636b9 100644 --- a/src/main/resources/reliccraft.mixins.json +++ b/src/main/resources/reliccraft.mixins.json @@ -12,6 +12,7 @@ "MixinEnderPearlItem", "MixinEntity", "MixinItemStack", + "MixinLakeFeature", "MixinLevelProperties", "MixinLivingEntity", "MixinLocateCommand",