mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 09:57:43 +01:00
29/310
This commit is contained in:
45
patches/server/0024-Charged-creeper-naturally-spawn.patch
Normal file
45
patches/server/0024-Charged-creeper-naturally-spawn.patch
Normal file
@@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Fri, 29 Nov 2019 22:37:44 -0600
|
||||
Subject: [PATCH] Charged creeper naturally spawn
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/monster/Creeper.java b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
index d2d7ca4666d4cfd43dfcc8697e0957921bc48e61..9658611850a266ee1acf347d3f90cf4922a89d3c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -178,6 +178,14 @@ public class Creeper extends Monster implements PowerableMob {
|
||||
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level.purpurConfig.creeperMaxHealth);
|
||||
}
|
||||
|
||||
+ public net.minecraft.world.entity.SpawnGroupData finalizeSpawn(net.minecraft.world.level.ServerLevelAccessor world, net.minecraft.world.DifficultyInstance difficulty, net.minecraft.world.entity.MobSpawnType spawnReason, @Nullable net.minecraft.world.entity.SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
|
||||
+ double chance = world.getLevel().purpurConfig.creeperChargedChance;
|
||||
+ if (chance > 0D && random.nextDouble() <= chance) {
|
||||
+ setPowered(true);
|
||||
+ }
|
||||
+ return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource source) {
|
||||
return SoundEvents.CREEPER_HURT;
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 9e0017fb69ea24c866fe78f0dc7cc90cfdb17517..51ed3dd68cd723d9865207a6296016eddec71791 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -270,6 +270,7 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public double creeperMaxHealth = 20.0D;
|
||||
+ public double creeperChargedChance = 0.0D;
|
||||
private void creeperSettings() {
|
||||
if (PurpurConfig.version < 10) {
|
||||
double oldValue = getDouble("mobs.creeper.attributes.max-health", creeperMaxHealth);
|
||||
@@ -277,6 +278,7 @@ public class PurpurWorldConfig {
|
||||
set("mobs.creeper.attributes.max_health", oldValue);
|
||||
}
|
||||
creeperMaxHealth = getDouble("mobs.creeper.attributes.max_health", creeperMaxHealth);
|
||||
+ creeperChargedChance = getDouble("mobs.creeper.naturally-charged-chance", creeperChargedChance);
|
||||
}
|
||||
|
||||
public double dolphinMaxHealth = 10.0D;
|
||||
Reference in New Issue
Block a user