geforkt von Mirrors/Paper
e035fd7034
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: cc9aa21a SPIGOT-6399, SPIGOT-7344: Clarify collidable behavior for player entities f23325b6 Add API for per-world simulation distances 26e1774e Add API for per-world view distances 0b541e60 Add PlayerLoginEvent#getRealAddress 5f027d2d PR-949: Add Vector#fromJOML() overloads for read-only vector types CraftBukkit Changes: bcf56171a PR-1321: Clean up some stuff which got missed during previous PRs 7f833a2d1 SPIGOT-7462: Players no longer drop XP after dying near a Sculk Catalyst 752aac669 Implement APIs for per world view and simulation distances 57d7ef433 Preserve empty enchantment tags for glow effect 465ec3fb4 Remove connected check on setScoreboard f90ce621e Use one PermissibleBase for all command blocks 5876cca44 SPIGOT-7550: Fix creation of Arrow instances f03fc3aa3 SPIGOT-7549: ServerTickManager#setTickRate incorrect Precondition 9d7f49b01 SPIGOT-7548: Fix wrong spawn location for experience orb and dropped item Spigot Changes: ed9ba9a4 Drop no longer required patch ignoring -o option 86b5dd6a SPIGOT-7546: Fix hardcoded check for outdated client message aa7cde7a Remove obsolete APIs for per world view and simulation distances 6dff577e Remove obsolete patch preserving empty `ench` tags a3bf95b8 Remove obsolete PlayerLoginEvent#getRealAddress 1b02f5d6 Remove obsolete connected check on setScoreboard patch acf717eb Remove obsolete command block PermissibleBase patch 053fa2a9 Remove redundant patch dealing with null tile entities
85 Zeilen
5.7 KiB
Diff
85 Zeilen
5.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Sun, 25 Sep 2022 11:21:01 -0700
|
|
Subject: [PATCH] Fixes and additions to the SpawnReason API
|
|
|
|
Fixes some wrong reasons, and adds missing spawn reasons for entities.
|
|
|
|
Co-authored-by: Doc <nachito94@msn.com>
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
index 823f3b3093cffb49ccdcbcfbe6d348009a553ad7..e754a294645e1af9e39bde32dd1387cd54335e7e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
|
@@ -353,7 +353,7 @@ public class EntityType<T extends Entity> implements FeatureElement, EntityTypeT
|
|
@Nullable
|
|
public T spawn(ServerLevel world, @Nullable ItemStack stack, @Nullable Player player, BlockPos pos, MobSpawnType spawnReason, boolean alignPosition, boolean invertY) {
|
|
// CraftBukkit start
|
|
- return this.spawn(world, stack, player, pos, spawnReason, alignPosition, invertY, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
|
+ return this.spawn(world, stack, player, pos, spawnReason, alignPosition, invertY, spawnReason == MobSpawnType.DISPENSER ? org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG : org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // Paper - use correct spawn reason for dispenser spawn eggs
|
|
}
|
|
|
|
@Nullable
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
|
index 9652e3385ad10e5d825dd141f6be3522c596916d..6256ce68d6ecada66745fb09360cba2bf991360c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
|
@@ -54,7 +54,7 @@ public class DragonFireball extends AbstractHurtingProjectile {
|
|
|
|
if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(LivingEntity::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) areaEffectCloud.getBukkitEntity()).callEvent()) { // Paper
|
|
this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
|
|
- this.level().addFreshEntity(areaEffectCloud);
|
|
+ this.level().addFreshEntity(areaEffectCloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // Paper
|
|
} else areaEffectCloud.discard(); // Paper
|
|
this.discard();
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
|
index 8f38965b42a20ac39cb1170278562070ebf2f958..a63733fa01dc58b3c0abb28c1cd88c8b0a456083 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/CarvedPumpkinBlock.java
|
|
@@ -92,7 +92,17 @@ public class CarvedPumpkinBlock extends HorizontalDirectionalBlock {
|
|
// clearPatternBlocks(world, shapedetector_shapedetectorcollection); // CraftBukkit - moved down
|
|
entity.moveTo((double) pos.getX() + 0.5D, (double) pos.getY() + 0.05D, (double) pos.getZ() + 0.5D, 0.0F, 0.0F);
|
|
// CraftBukkit start
|
|
- if (!world.addFreshEntity(entity, SpawnReason.BUILD_IRONGOLEM)) {
|
|
+ // Paper start - correct spawn reason
|
|
+ final SpawnReason spawnReason;
|
|
+ if (entity.getType() == EntityType.SNOW_GOLEM) {
|
|
+ spawnReason = SpawnReason.BUILD_SNOWMAN;
|
|
+ } else if (entity.getType() == EntityType.IRON_GOLEM) {
|
|
+ spawnReason = SpawnReason.BUILD_IRONGOLEM;
|
|
+ } else {
|
|
+ spawnReason = SpawnReason.DEFAULT;
|
|
+ }
|
|
+ if (!world.addFreshEntity(entity, spawnReason)) {
|
|
+ // Paper end
|
|
return;
|
|
}
|
|
CarvedPumpkinBlock.clearPatternBlocks(world, patternResult); // CraftBukkit - from above
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
|
index 0a2de99c22cfcc96a664dc2afe7379987ea815db..6fc8d7f93141d85d8aecc97314e747624beb5e6c 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
|
@@ -117,7 +117,7 @@ public class FrogspawnBlock extends Block {
|
|
int k = random.nextInt(1, 361);
|
|
tadpole.moveTo(d, (double)pos.getY() - 0.5D, e, (float)k, 0.0F);
|
|
tadpole.setPersistenceRequired();
|
|
- world.addFreshEntity(tadpole);
|
|
+ world.addFreshEntity(tadpole, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
|
index 3cedc349e79665d3d471c92b5dca25c9e66ca0bf..6c025c0fac9bd6373b99e374b773ca626d47ee6d 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java
|
|
@@ -88,7 +88,7 @@ public class SnifferEggBlock extends Block {
|
|
Vec3 vec3 = pos.getCenter();
|
|
sniffer.setBaby(true);
|
|
sniffer.moveTo(vec3.x(), vec3.y(), vec3.z(), Mth.wrapDegrees(world.random.nextFloat() * 360.0F), 0.0F);
|
|
- world.addFreshEntity(sniffer);
|
|
+ world.addFreshEntity(sniffer, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper
|
|
}
|
|
|
|
}
|