Files
Purpur/patches/server/0026-Charged-creeper-naturally-spawn.patch
granny 0458d847e2 Updated Upstream (Paper & Pufferfish)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@44ee1cd fix recipe packet limiter (#9841)
PaperMC/Paper@e57af7d sync netty version with vanilla (#9842)

Pufferfish Changes:
pufferfish-gg/Pufferfish@0020a8b Port a patch from upstream
pufferfish-gg/Pufferfish@979d3a2 Update upstream (last 1.20.1)
pufferfish-gg/Pufferfish@06262c1 Initial 1.20.2 update
2023-10-16 04:52:01 -07:00

46 lines
2.6 KiB
Diff

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 e31094f270117dec3053620c06e409953fb6d710..a1e3f29ce49dc41ad70f74ee224250fe9ebea175 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -255,6 +255,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 bae186807d44745942faf8919831f82e475a4f63..8503f57e3b07318331045aa25aa0fd07b8ca17ed 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -345,6 +345,7 @@ public class PurpurWorldConfig {
public boolean creeperRidableInWater = true;
public boolean creeperControllable = true;
public double creeperMaxHealth = 20.0D;
+ public double creeperChargedChance = 0.0D;
private void creeperSettings() {
creeperRidable = getBoolean("mobs.creeper.ridable", creeperRidable);
creeperRidableInWater = getBoolean("mobs.creeper.ridable-in-water", creeperRidableInWater);
@@ -355,6 +356,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 boolean dolphinRidable = false;