Skip to content

Commit

Permalink
Mooblooms replace cow spawns
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Feb 4, 2025
1 parent f0110a3 commit e034e4e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public BaobabTrunkPlacer(int i, int j, int k, @NotNull BlockStateProvider inside
this.insideState = insideState;
}

protected static <P extends BaobabTrunkPlacer> Products.@NotNull P4<RecordCodecBuilder.Mu<P>, Integer, Integer, Integer, BlockStateProvider> baobabCodec(RecordCodecBuilder.Instance<P> builder) {
protected static <P extends BaobabTrunkPlacer> Products.@NotNull P4<RecordCodecBuilder.Mu<P>, Integer, Integer, Integer, BlockStateProvider> baobabCodec(
RecordCodecBuilder.Instance<P> builder
) {
return trunkPlacerParts(builder).and((BlockStateProvider.CODEC.fieldOf("inside_state")).forGetter(placer -> placer.insideState));
}

Expand Down Expand Up @@ -117,7 +119,6 @@ protected TrunkPlacerType<?> type() {
* 3- Add Branches and Foliage
* Easy, I guess ._.
**/

@Override
@NotNull
public List<FoliagePlacer.FoliageAttachment> placeTrunk(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@

import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.biome.v1.ModificationPhase;
import net.frozenblock.lib.entity.api.category.FrozenMobCategories;
import net.frozenblock.wilderwild.WWConstants;
import net.frozenblock.wilderwild.registry.WWEntityTypes;
import net.frozenblock.wilderwild.tag.WWBiomeTags;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.world.level.biome.MobSpawnSettings;

public final class WWSpawns {

Expand Down Expand Up @@ -72,7 +74,21 @@ public static void addRabbits() {
}

public static void addMooblooms() {
BiomeModifications.addSpawn(BiomeSelectors.tag(WWBiomeTags.HAS_MOOBLOOM),
MobCategory.CREATURE, WWEntityTypes.MOOBLOOM, 34, 2, 2);
BiomeModifications.create(WWConstants.id("moobloom_spawns")).add(
ModificationPhase.REPLACEMENTS,
BiomeSelectors.tag(WWBiomeTags.HAS_MOOBLOOM),
(biomeSelectionContext, biomeModificationContext) -> {
biomeModificationContext.getSpawnSettings().removeSpawnsOfEntityType(EntityType.COW);
biomeModificationContext.getSpawnSettings().addSpawn(
MobCategory.CREATURE,
new MobSpawnSettings.SpawnerData(
WWEntityTypes.MOOBLOOM,
34,
2,
4
)
);
}
);
}
}

0 comments on commit e034e4e

Please sign in to comment.