mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Despawn egg hatches chicken
This commit is contained in:
@@ -148,6 +148,11 @@ mobs
|
||||
- **default**: true
|
||||
- **description**: Require shift click to mount otherwise non-ridable mobs
|
||||
|
||||
* chicken
|
||||
* eggs-hatch-when-despawned
|
||||
- **default:** false
|
||||
- **description:** When chicken egg despawns a chicken is hatched in its place
|
||||
|
||||
* cow
|
||||
* feed-mushrooms-for-mooshroom
|
||||
- **default**: 0
|
||||
|
||||
58
patches/server/0085-Despawn-egg-hatches-chicken.patch
Normal file
58
patches/server/0085-Despawn-egg-hatches-chicken.patch
Normal file
@@ -0,0 +1,58 @@
|
||||
From 19dfa417405272bbab21d90f3fd0a88828ebb0c7 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Fri, 29 Nov 2019 23:47:42 -0600
|
||||
Subject: [PATCH] Despawn egg hatches chicken
|
||||
|
||||
---
|
||||
.../java/net/minecraft/server/EntityItem.java | 18 ++++++++++++++++++
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
|
||||
2 files changed, 23 insertions(+)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index df26cef6a6..4849f600a1 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -164,6 +164,24 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
// Spigot end
|
||||
|
||||
+ // Purpur start
|
||||
+ @Override
|
||||
+ public void die() {
|
||||
+ if (!dead && net.pl3x.purpur.PurpurConfig.chickenEggsHatchWhenDespawned) {
|
||||
+ ItemStack item = getItemStack();
|
||||
+ if (item != null && item.getItem() == Items.EGG) {
|
||||
+ EntityChicken chicken = EntityTypes.CHICKEN.create(world);
|
||||
+ if (chicken != null) {
|
||||
+ chicken.setPosition(locX, locY, locZ);
|
||||
+ chicken.setAge(-24000);
|
||||
+ world.addEntity(chicken, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ super.die();
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
private void v() {
|
||||
Vec3D vec3d = this.getMot();
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index b5f12373a9..efdf01e98c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -203,6 +203,11 @@ public class PurpurConfig {
|
||||
armorstandStepHeight = (float) getDouble("settings.armorstand.step-height", armorstandStepHeight);
|
||||
}
|
||||
|
||||
+ public static boolean chickenEggsHatchWhenDespawned = false;
|
||||
+ private static void chickenSettings() {
|
||||
+ chickenEggsHatchWhenDespawned = getBoolean("settings.mobs.chicken.eggs-hatch-when-despawned", chickenEggsHatchWhenDespawned);
|
||||
+ }
|
||||
+
|
||||
public static int feedMushroomsToCows = 0;
|
||||
private static void cowsSettings() {
|
||||
feedMushroomsToCows = getInt("settings.mobs.cow.feed-mushrooms-for-mooshroom", feedMushroomsToCows);
|
||||
--
|
||||
2.24.0.rc1
|
||||
|
||||
Reference in New Issue
Block a user