mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 00:47:42 +01:00
69 lines
2.8 KiB
Diff
69 lines
2.8 KiB
Diff
From 19c255144560ce388e919ed5844ec2d4f8ebb267 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 ebae462807..5dd9a57234 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 81f41ccc77..544c68b0d8 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 giantsNaturallySpawn = true;
|
|
public static boolean giantsHaveAI = true;
|
|
private static void giantsSettings() {
|
|
--
|
|
2.24.0
|
|
|