mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
69 lines
2.8 KiB
Diff
69 lines
2.8 KiB
Diff
From 3a270f96763f004d959fc1d455972c2dac4a0d6a 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] Add charged creeper spawn chance
|
|
|
|
---
|
|
.../java/net/minecraft/server/EntityCreeper.java | 16 ++++++++++++++++
|
|
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
|
|
2 files changed, 21 insertions(+)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
|
|
index 9bce3f7716..be6a1ea054 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
|
|
@@ -1,11 +1,16 @@
|
|
package net.minecraft.server;
|
|
|
|
+import java.time.LocalDate;
|
|
+import java.time.temporal.ChronoField;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
+import java.util.List;
|
|
// CraftBukkit start
|
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
|
+
|
|
+import javax.annotation.Nullable;
|
|
// CraftBukkit end
|
|
|
|
public class EntityCreeper extends EntityMonster {
|
|
@@ -70,6 +75,17 @@ public class EntityCreeper extends EntityMonster {
|
|
this.datawatcher.register(EntityCreeper.d, false);
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ @Nullable
|
|
+ @Override
|
|
+ public GroupDataEntity prepare(GeneratorAccess generatoraccess, DifficultyDamageScaler difficultydamagescaler, EnumMobSpawn enummobspawn, @Nullable GroupDataEntity groupdataentity, @Nullable NBTTagCompound nbttagcompound) {
|
|
+ if (net.pl3x.purpur.PurpurConfig.chargedCreeperChance > 0D && net.pl3x.purpur.PurpurConfig.chargedCreeperChance > random.nextDouble()) {
|
|
+ setPowered(true);
|
|
+ }
|
|
+ return super.prepare(generatoraccess, difficultydamagescaler, enummobspawn, groupdataentity, nbttagcompound);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Override
|
|
public void b(NBTTagCompound nbttagcompound) {
|
|
super.b(nbttagcompound);
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
index 4bf208b35c..b5f12373a9 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -208,6 +208,11 @@ public class PurpurConfig {
|
|
feedMushroomsToCows = getInt("settings.mobs.cow.feed-mushrooms-for-mooshroom", feedMushroomsToCows);
|
|
}
|
|
|
|
+ public static double chargedCreeperChance = 0.0D;
|
|
+ private static void creeperSettings() {
|
|
+ chargedCreeperChance = getDouble("settings.mobs.creeper.naturally-charged-chance", chargedCreeperChance);
|
|
+ }
|
|
+
|
|
public static boolean enderDragonAlwaysDropsEggBlock = false;
|
|
public static boolean enderDragonAlwaysDropsFullExp = false;
|
|
private static void enderDragonSettings() {
|
|
--
|
|
2.24.0.rc1
|
|
|