This commit is contained in:
BillyGalbreath
2021-06-17 15:30:00 -05:00
parent 02377a8ecd
commit 321c252f05
20 changed files with 2166 additions and 193 deletions

View File

@@ -5,59 +5,27 @@ 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 e8c36e8541f041a0d72a86f49ced2a3ce1549be0..27d8279b71f55ae711b0455bb4c5f1527a0e1ccb 100644
index 1bf65519883585569a1acc780554505dc5d6c30b..f8fba694d53356036e302f66cfe92b15726242dc 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
@@ -11,6 +11,7 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.Mth;
+import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@@ -20,7 +21,9 @@ import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LightningBolt;
import net.minecraft.world.entity.LivingEntity;
+import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.PowerableMob;
+import net.minecraft.world.entity.SpawnGroupData;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.AvoidEntityGoal;
@@ -38,10 +41,7 @@ import net.minecraft.world.entity.animal.goat.Goat;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
-import net.minecraft.world.level.Explosion;
-import net.minecraft.world.level.GameRules;
-import net.minecraft.world.level.ItemLike;
-import net.minecraft.world.level.Level;
+import net.minecraft.world.level.*;
import net.minecraft.world.level.gameevent.GameEvent;
// CraftBukkit start
@@ -65,6 +65,17 @@ public class Creeper extends Monster implements PowerableMob {
super(type, world);
@@ -129,6 +129,15 @@ public class Creeper extends Monster implements PowerableMob {
}
return getForwardMot() == 0 && getStrafeMot() == 0; // do not jump if standing still
}
+ // Purpur start
+
+ @Override
+ public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType spawnReason, @Nullable SpawnGroupData entityData, @Nullable CompoundTag entityNbt) {
+ 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.getMinecraftWorld().purpurConfig.creeperChargedChance;
+ if (chance > 0D && random.nextDouble() <= chance) {
+ setPowered(true);
+ }
+ return super.finalizeSpawn(world, difficulty, spawnReason, entityData, entityNbt);
+ }
+ // Purpur end
+
// Purpur end
@Override
protected void registerGoals() {
this.goalSelector.addGoal(1, new FloatGoal(this));
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index d8011e5fe28458ae62f764cc355838bd08491f94..375eb6499a91e73310e93d6d42eaa799751f22a2 100644
index e66fd35e16e152d18b511d727558b50d5071633f..d2772e9d8cc9027994e98633594f20dc58a652cf 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -180,9 +180,11 @@ public class PurpurWorldConfig {