aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/entity/projectile/EntityEgg.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/og/net/minecraft/world/entity/projectile/EntityEgg.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/projectile/EntityEgg.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/entity/projectile/EntityEgg.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/projectile/EntityEgg.patch b/patch-remap/og/net/minecraft/world/entity/projectile/EntityEgg.patch
new file mode 100644
index 0000000000..ba9188ddf6
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/projectile/EntityEgg.patch
@@ -0,0 +1,71 @@
+--- a/net/minecraft/world/entity/projectile/EntityEgg.java
++++ b/net/minecraft/world/entity/projectile/EntityEgg.java
+@@ -11,6 +11,15 @@
+ import net.minecraft.world.phys.MovingObjectPosition;
+ import net.minecraft.world.phys.MovingObjectPositionEntity;
+
++// CraftBukkit start
++import net.minecraft.server.level.EntityPlayer;
++import net.minecraft.world.entity.Entity;
++import org.bukkit.entity.Ageable;
++import org.bukkit.entity.EntityType;
++import org.bukkit.entity.Player;
++import org.bukkit.event.player.PlayerEggThrowEvent;
++// CraftBukkit end
++
+ public class EntityEgg extends EntityProjectileThrowable {
+
+ public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
+@@ -47,20 +56,47 @@
+ protected void onHit(MovingObjectPosition movingobjectposition) {
+ super.onHit(movingobjectposition);
+ if (!this.level().isClientSide) {
+- if (this.random.nextInt(8) == 0) {
++ // CraftBukkit start
++ boolean hatching = this.random.nextInt(8) == 0;
++ if (true) {
++ // CraftBukkit end
+ byte b0 = 1;
+
+ if (this.random.nextInt(32) == 0) {
+ b0 = 4;
+ }
+
++ // CraftBukkit start
++ EntityType hatchingType = EntityType.CHICKEN;
++
++ Entity shooter = this.getOwner();
++ if (!hatching) {
++ b0 = 0;
++ }
++ if (shooter instanceof EntityPlayer) {
++ PlayerEggThrowEvent event = new PlayerEggThrowEvent((Player) shooter.getBukkitEntity(), (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, b0, hatchingType);
++ this.level().getCraftServer().getPluginManager().callEvent(event);
++
++ b0 = event.getNumHatches();
++ hatching = event.isHatching();
++ hatchingType = event.getHatchingType();
++ // If hatching is set to false, ensure child count is 0
++ if (!hatching) {
++ b0 = 0;
++ }
++ }
++ // CraftBukkit end
++
+ for (int i = 0; i < b0; ++i) {
+- EntityChicken entitychicken = (EntityChicken) EntityTypes.CHICKEN.create(this.level());
++ Entity entitychicken = this.level().getWorld().makeEntity(new org.bukkit.Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F), hatchingType.getEntityClass()); // CraftBukkit
+
+ if (entitychicken != null) {
+- entitychicken.setAge(-24000);
+- entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
+- this.level().addFreshEntity(entitychicken);
++ // CraftBukkit start
++ if (entitychicken.getBukkitEntity() instanceof Ageable) {
++ ((Ageable) entitychicken.getBukkitEntity()).setBaby();
++ }
++ this.level().addFreshEntity(entitychicken, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
++ // CraftBukkit end
+ }
+ }
+ }