-
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- clean up cyclops cave gen / dragon cave gen - increase client dragon for some entities (in theory all entities should be increased to 8 or sth) - better biome checking for dragon caves - seperate dangerous generation check between surface, underground and ocean
- Loading branch information
Showing
27 changed files
with
508 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/com/github/alexthe666/iceandfire/world/CustomBiomeFilter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.github.alexthe666.iceandfire.world; | ||
|
||
import com.mojang.serialization.Codec; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.level.levelgen.Heightmap; | ||
import net.minecraft.world.level.levelgen.placement.PlacedFeature; | ||
import net.minecraft.world.level.levelgen.placement.PlacementContext; | ||
import net.minecraft.world.level.levelgen.placement.PlacementFilter; | ||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
/** | ||
Some worldgen mods / datapacks split biomes between cave and surface<br> | ||
By default dragon caves (or any underground generation) would only check against the cave biome, not the surface biome)<br> | ||
Since the passed y position will be the lowest point of the world (e.g. -64) | ||
*/ | ||
public class CustomBiomeFilter extends PlacementFilter { | ||
private static final CustomBiomeFilter INSTANCE = new CustomBiomeFilter(); | ||
public static Codec<CustomBiomeFilter> CODEC = Codec.unit(() -> INSTANCE); | ||
|
||
private CustomBiomeFilter() { /* Nothing to do */ } | ||
|
||
public static CustomBiomeFilter biome() { | ||
return INSTANCE; | ||
} | ||
|
||
protected boolean shouldPlace(final PlacementContext context, @NotNull final RandomSource random, @NotNull final BlockPos position) { | ||
PlacedFeature placedfeature = context.topFeature().orElseThrow(() -> new IllegalStateException("Tried to biome check an unregistered feature, or a feature that should not restrict the biome")); | ||
boolean hasFeature = context.generator().getBiomeGenerationSettings(context.getLevel().getBiome(position)).hasFeature(placedfeature); | ||
|
||
if (!hasFeature) { | ||
// TODO :: In theory this could cause a fire dragon cave to spawn in an Terralith ice cave if said cave spawns below a desert or sth. | ||
hasFeature = context.generator().getBiomeGenerationSettings(context.getLevel().getBiome(context.getLevel().getHeightmapPos(Heightmap.Types.WORLD_SURFACE_WG, position))).hasFeature(placedfeature); | ||
} | ||
|
||
return hasFeature; | ||
} | ||
|
||
public @NotNull PlacementModifierType<?> type() { | ||
return IafPlacementFilterRegistry.CUSTOM_BIOME_FILTER.get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.github.alexthe666.iceandfire.world; | ||
|
||
import com.github.alexthe666.iceandfire.IceAndFire; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType; | ||
import net.minecraftforge.registries.DeferredRegister; | ||
import net.minecraftforge.registries.RegistryObject; | ||
|
||
public class IafPlacementFilterRegistry { | ||
public static final DeferredRegister<PlacementModifierType<?>> PLACEMENT_MODIFIER_TYPES = DeferredRegister.create(Registries.PLACEMENT_MODIFIER_TYPE, IceAndFire.MODID); | ||
|
||
public static RegistryObject<PlacementModifierType<CustomBiomeFilter>> CUSTOM_BIOME_FILTER = PLACEMENT_MODIFIER_TYPES.register("biome_extended", () -> () -> CustomBiomeFilter.CODEC); | ||
} |
Oops, something went wrong.