Skip to content

Commit

Permalink
Implement config switches for worldgen spawning
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Feb 18, 2024
1 parent 1588317 commit 879b301
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
org.gradle.jvmargs=-Xmx3G
# Mod Information
mod_id=mocreatures
mod_version=12.4.1
mod_version=12.4.2
maven_group=drzhark.mocreatures
archives_base_name=DrZharks-MoCreatures-Extended
# License Plugin
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/drzhark/mocreatures/MoCConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class MoCConstants {
public static final String MOD_ID = "mocreatures";
public static final String MOD_PREFIX = MOD_ID + ":";
public static final String MOD_NAME = "DrZhark's Mo'Creatures Extended";
public static final String MOD_VERSION = "12.4.1";
public static final String MOD_VERSION = "12.4.2";
public static final String MOD_ACCEPTED_VERSIONS = "[" + MOD_VERSION + "]";
public static final String MOD_DEPENDENCIES = "after:futuremc;after:thaumcraft;after:thermalexpansion;after:traverse";
public static final Integer DATAFIXER_VERSION = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package drzhark.mocreatures.event;

import drzhark.mocreatures.MoCTools;
import drzhark.mocreatures.MoCreatures;
import drzhark.mocreatures.entity.IMoCEntity;
import drzhark.mocreatures.init.MoCEntities;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
Expand All @@ -16,7 +17,6 @@
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.ForgeRegistries;

Expand Down Expand Up @@ -69,7 +69,7 @@ public static void addBiomeTypes() {

@SubscribeEvent
public void onPopulateChunk(PopulateChunkEvent.Populate event) {
// Regular spawning
if (!MoCreatures.proxy.worldGenSpawningCreatures && !MoCreatures.proxy.worldGenSpawningWaterCreatures) return;
if (event.getType() == PopulateChunkEvent.Populate.EventType.ANIMALS) {
int chunkX = event.getChunkX() * 16;
int chunkZ = event.getChunkZ() * 16;
Expand All @@ -80,8 +80,10 @@ public void onPopulateChunk(PopulateChunkEvent.Populate event) {
BlockPos blockPos = new BlockPos(chunkX, 0, chunkZ);
Biome biome = world.getBiome(blockPos.add(16, 0, 16));

MoCTools.performCustomWorldGenSpawning(world, biome, centerX, centerZ, 16, 16, rand, creatureSpawnMap.get(biome), EntityLiving.SpawnPlacementType.ON_GROUND);
MoCTools.performCustomWorldGenSpawning(world, biome, centerX, centerZ, 16, 16, rand, waterCreatureSpawnMap.get(biome), EntityLiving.SpawnPlacementType.IN_WATER);
if (MoCreatures.proxy.worldGenSpawningCreatures)
MoCTools.performCustomWorldGenSpawning(world, biome, centerX, centerZ, 16, 16, rand, creatureSpawnMap.get(biome), EntityLiving.SpawnPlacementType.ON_GROUND);
if (MoCreatures.proxy.worldGenSpawningWaterCreatures)
MoCTools.performCustomWorldGenSpawning(world, biome, centerX, centerZ, 16, 16, rand, waterCreatureSpawnMap.get(biome), EntityLiving.SpawnPlacementType.IN_WATER);
}
}
}
8 changes: 6 additions & 2 deletions src/main/java/drzhark/mocreatures/proxy/MoCProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,18 @@ public class MoCProxy implements IGuiHandler {
public boolean foggyWyvernLair;
public boolean golemDestroyBlocks;
public boolean legacyBigCatModels;
public boolean legacySharkModel;
public boolean legacyBunnyTextures;
public boolean legacyRatDeathSound;
public boolean legacySharkModel;
public boolean legacyWerehumanSounds;
public boolean legacyWraithSounds;
public boolean legacyWyvernLairSky;
public boolean staticBed;
public boolean staticLitter;
public boolean verboseEntityNames;
public boolean weaponEffects;
public boolean worldGenSpawningCreatures;
public boolean worldGenSpawningWaterCreatures;
public boolean worldInitDone = false;
public double spawnMultiplier;
public float ogreCaveStrength;
Expand Down Expand Up @@ -278,9 +280,9 @@ public void readGlobalConfigValues() {
this.golemDestroyBlocks = this.mocSettingsConfig.get(CATEGORY_MOC_MONSTER_GENERAL_SETTINGS, "GolemDestroyBlocks", true, "Allows big golems to break blocks.").getBoolean(true);
this.kittyVillageChance = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "KittyVillageChance", 15, "The percentage for kitties spawning in village chunks.").getInt();
this.legacyBigCatModels = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "LegacyBigCatModels", false, "Enables simple big cat models and textures like in legacy versions.").getBoolean(false);
this.legacySharkModel = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "LegacySharkModel", false, "Enables the simple shark model and texture like in legacy versions.").getBoolean(false);
this.legacyBunnyTextures = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "LegacyBunnyTextures", false, "Enables simple bunny textures like in legacy versions.").getBoolean(false);
this.legacyRatDeathSound = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "LegacyRatDeathSound", false, "Enables legacy rat death sound.").getBoolean(false);
this.legacySharkModel = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "LegacySharkModel", false, "Enables the simple shark model and texture like in legacy versions.").getBoolean(false);
this.legacyWerehumanSounds = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "LegacyWerehumanSounds", false, "Enables legacy human werewolf sounds.").getBoolean(false);
this.legacyWraithSounds = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "LegacyWraithSounds", false, "Enables legacy wraith sounds.").getBoolean(false);
this.legacyWyvernLairSky = this.mocSettingsConfig.get(CATEGORY_MOC_GENERAL_SETTINGS, "LegacyWyvernLairSky", false, "Enables legacy wyvern lair sky.").getBoolean(false);
Expand All @@ -299,6 +301,8 @@ public void readGlobalConfigValues() {
this.staticLitter = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "StaticLitter", true, "Makes the kitty litter box not pushable.").getBoolean(true);
this.verboseEntityNames = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "VerboseEntityNames", false, "Enables detailed names for creatures, describing their species.").getBoolean(false);
this.weaponEffects = this.mocSettingsConfig.get(CATEGORY_MOC_GENERAL_SETTINGS, "WeaponEffects", true, "Applies potion effects when dealing damage with scorpion weapons.").getBoolean(true);
this.worldGenSpawningCreatures = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "WorldGenSpawningCreatures", true, "Enables custom creature spawning during world generation. Disable this when facing spawning issues with entities from other mods.").getBoolean(true);
this.worldGenSpawningWaterCreatures = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "WorldGenSpawningWaterCreatures", true, "Enables custom water creature spawning during world generation. Disable this when facing spawning issues with entities from other mods.").getBoolean(true);
this.wyvernDimension = this.mocSettingsConfig.get(CATEGORY_MOC_ID_SETTINGS, "WyvernLairDimensionID", -17, "The dimension ID of the wyvern lair.").getInt();
this.wyvernEggDropChance = this.mocSettingsConfig.get(CATEGORY_MOC_CREATURE_GENERAL_SETTINGS, "WyvernEggDropChance", 33, "The percentage for wyverns to drop an egg.").getInt();

Expand Down

0 comments on commit 879b301

Please sign in to comment.