mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
Special mobs naturally spawn
This commit is contained in:
committed by
granny
parent
25c3e2dd6c
commit
0a29e9cd1c
@@ -0,0 +1,22 @@
|
||||
--- a/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -934,9 +_,18 @@
|
||||
&& this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
|
||||
&& !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD);
|
||||
if (flag) {
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ net.minecraft.world.entity.animal.horse.AbstractHorse entityhorseskeleton;
|
||||
+ if (purpurConfig.zombieHorseSpawnChance > 0D && random.nextDouble() <= purpurConfig.zombieHorseSpawnChance) {
|
||||
+ entityhorseskeleton = EntityType.ZOMBIE_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
+ } else {
|
||||
+ entityhorseskeleton = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
+ if (entityhorseskeleton != null) ((SkeletonHorse) entityhorseskeleton).setTrap(true);
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
SkeletonHorse skeletonHorse = EntityType.SKELETON_HORSE.create(this, EntitySpawnReason.EVENT);
|
||||
if (skeletonHorse != null) {
|
||||
- skeletonHorse.setTrap(true);
|
||||
+ //skeletonHorse.setTrap(true); // Purpur - Special mobs naturally spawn - moved up
|
||||
skeletonHorse.setAge(0);
|
||||
skeletonHorse.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ());
|
||||
this.addFreshEntity(skeletonHorse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
|
||||
@@ -0,0 +1,26 @@
|
||||
--- a/net/minecraft/world/entity/animal/Rabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/Rabbit.java
|
||||
@@ -376,10 +_,23 @@
|
||||
}
|
||||
|
||||
this.setVariant(randomRabbitVariant);
|
||||
+
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ if (randomRabbitVariant != Variant.EVIL && level.getLevel().purpurConfig.rabbitNaturalToast > 0D && random.nextDouble() <= level.getLevel().purpurConfig.rabbitNaturalToast) {
|
||||
+ setCustomName(Component.translatable("Toast"));
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
+
|
||||
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
|
||||
}
|
||||
|
||||
private static Rabbit.Variant getRandomRabbitVariant(LevelAccessor level, BlockPos pos) {
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ Level world = level.getMinecraftWorld();
|
||||
+ if (world.purpurConfig.rabbitNaturalKiller > 0D && world.getRandom().nextDouble() <= world.purpurConfig.rabbitNaturalKiller) {
|
||||
+ return Rabbit.Variant.EVIL;
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
Holder<Biome> biome = level.getBiome(pos);
|
||||
int randomInt = level.getRandom().nextInt(100);
|
||||
if (biome.is(BiomeTags.SPAWNS_WHITE_RABBITS)) {
|
||||
@@ -0,0 +1,19 @@
|
||||
--- a/net/minecraft/world/entity/monster/Creeper.java
|
||||
+++ b/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -161,6 +_,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.EntitySpawnReason spawnReason, @Nullable net.minecraft.world.entity.SpawnGroupData entityData) {
|
||||
+ double chance = world.getLevel().purpurConfig.creeperChargedChance;
|
||||
+ if (chance > 0D && random.nextDouble() <= chance) {
|
||||
+ setPowered(true);
|
||||
+ }
|
||||
+ return super.finalizeSpawn(world, difficulty, spawnReason, entityData);
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
+
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSource) {
|
||||
return SoundEvents.CREEPER_HURT;
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/net/minecraft/world/entity/monster/Vindicator.java
|
||||
+++ b/net/minecraft/world/entity/monster/Vindicator.java
|
||||
@@ -132,6 +_,11 @@
|
||||
RandomSource random = level.getRandom();
|
||||
this.populateDefaultEquipmentSlots(random, difficulty);
|
||||
this.populateDefaultEquipmentEnchantments(level, random, difficulty);
|
||||
+ // Purpur start - Special mobs naturally spawn
|
||||
+ if (level().purpurConfig.vindicatorJohnnySpawnChance > 0D && random.nextDouble() <= level().purpurConfig.vindicatorJohnnySpawnChance) {
|
||||
+ setCustomName(Component.translatable("Johnny"));
|
||||
+ }
|
||||
+ // Purpur end - Special mobs naturally spawn
|
||||
return spawnGroupData1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user