Updated Upstream (Bukkit/CraftBukkit)
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: e2160a18 Make MapCursor#type not depends on deprecated values CraftBukkit Changes: 6ce172642 SPIGOT-7761: Ender pearl does not damage or spawn endermites f5a63f734 SPIGOT-7759: Chunk not there when requested in ChunkUnloadEvent 28287259c Remove unused import eb9a7dde0 SPIGOT-7757: Cannot set item in Stonecutter Inventory f8be9d752 Move deserialized removed unhandled tags to dedicated removedTags a7e576186 Fix potential mutability issue with CraftMetaItem copy constructor 995885452 SPIGOT-7741: Vanilla ItemComponent in commands can't remove components 9ef69aa0b PR-1284: Move ItemType <-> ItemMeta linking to a centralized place 3e82eafbe PR-1420: Fix DirectEntity and CausingEntity Damager for Creepers ignited by Player c23daa71f SPIGOT-7751: Fix crash caused by arrows from trial spawners Make MapCursor#type not depends on deprecated values SPIGOT-7761: Ender pearl does not damage or spawn endermites
This commit is contained in:
parent
5d834b1b71
commit
4bc15f13aa
163 changed files with 758 additions and 725 deletions
|
@ -7,42 +7,58 @@ Uses the correct entity in the EntityDamageByEntity event
|
|||
Returns the correct entity for API's DamageSource#getCausingEntity
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/damagesource/DamageSource.java b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
index 10bee9b217fae9170af9d66dac9741046be1cab6..bb1a60180e58c1333e7bb33e8acf1b0225eda8a8 100644
|
||||
index aee26dd78953ff43306aaa64161f5b9edcdd4b83..bb1a60180e58c1333e7bb33e8acf1b0225eda8a8 100644
|
||||
--- a/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/src/main/java/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -29,7 +29,8 @@ public class DamageSource {
|
||||
@@ -29,8 +29,8 @@ public class DamageSource {
|
||||
private boolean sweep = false;
|
||||
private boolean melting = false;
|
||||
private boolean poison = false;
|
||||
- private Entity customEntityDamager = null; // This field is a helper for when causing entity damage is not set by vanilla
|
||||
- private Entity customEntityDamager = null; // This field is a helper for when direct entity damage is not set by vanilla
|
||||
- private Entity customCausingEntityDamager = null; // This field is a helper for when causing entity damage is not set by vanilla
|
||||
+ @Nullable
|
||||
+ private Entity customEventDamager = null; // This field is a helper for when causing entity damage is not set by vanilla // Paper - fix DamageSource API
|
||||
|
||||
public DamageSource sweep() {
|
||||
this.sweep = true;
|
||||
@@ -58,18 +59,19 @@ public class DamageSource {
|
||||
@@ -59,33 +59,19 @@ public class DamageSource {
|
||||
return this.poison;
|
||||
}
|
||||
|
||||
- public Entity getDamager() {
|
||||
- return (this.customEntityDamager != null) ? this.customEntityDamager : this.directEntity;
|
||||
- }
|
||||
-
|
||||
- public Entity getCausingDamager() {
|
||||
- return (this.customCausingEntityDamager != null) ? this.customCausingEntityDamager : this.causingEntity;
|
||||
- }
|
||||
-
|
||||
- public DamageSource customEntityDamager(Entity entity) {
|
||||
- // This method is not intended for change the causing entity if is already set
|
||||
- // also is only necessary if the entity passed is not the direct entity or different from the current causingEntity
|
||||
- if (this.customEntityDamager != null || this.directEntity == entity || this.causingEntity == entity) {
|
||||
- return this;
|
||||
- }
|
||||
- DamageSource damageSource = this.cloneInstance();
|
||||
- damageSource.customEntityDamager = entity;
|
||||
- return damageSource;
|
||||
+ // Paper start - fix DamageSource API
|
||||
+ @Nullable
|
||||
+ public Entity getCustomEventDamager() {
|
||||
+ return (this.customEventDamager != null) ? this.customEventDamager : this.directEntity;
|
||||
}
|
||||
|
||||
- public DamageSource customEntityDamager(Entity entity) {
|
||||
- public DamageSource customCausingEntityDamager(Entity entity) {
|
||||
- // This method is not intended for change the causing entity if is already set
|
||||
- // also is only necessary if the entity passed is not the direct entity or different from the current causingEntity
|
||||
- if (this.customEntityDamager != null || this.directEntity == entity || this.causingEntity == entity) {
|
||||
- if (this.customCausingEntityDamager != null || this.directEntity == entity || this.causingEntity == entity) {
|
||||
- return this;
|
||||
+ public DamageSource customEventDamager(Entity entity) {
|
||||
+ if (this.directEntity != null) {
|
||||
+ throw new IllegalStateException("Cannot set custom event damager when direct entity is already set (report a bug to Paper)");
|
||||
}
|
||||
DamageSource damageSource = this.cloneInstance();
|
||||
- damageSource.customEntityDamager = entity;
|
||||
- damageSource.customCausingEntityDamager = entity;
|
||||
+ damageSource.customEventDamager = entity;
|
||||
+ // Paper end - fix DamageSource API
|
||||
return damageSource;
|
||||
|
@ -107,14 +123,14 @@ index 7bc612890f941177da11da0ce047d5a74d8ebb33..270acce7411e5ada71eaa04c05efc888
|
|||
if (damager != null) {
|
||||
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), source.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
|
||||
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 acc844c10db9cb42c0e70f3b467e620906b739f0..cb1b19e2e0d8f0744b2355b8f4da0206b196b19c 100644
|
||||
index 2c01fbea62812f795111060d260f871cdf85e8bf..cb1b19e2e0d8f0744b2355b8f4da0206b196b19c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/monster/Creeper.java
|
||||
@@ -271,7 +271,7 @@ public class Creeper extends Monster implements PowerableMob {
|
||||
if (!event.isCancelled()) {
|
||||
// CraftBukkit end
|
||||
this.dead = true;
|
||||
- this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customEntityDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit
|
||||
- this.level().explode(this, net.minecraft.world.level.Explosion.getDefaultDamageSource(this.level(), this).customCausingEntityDamager(this.entityIgniter), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit
|
||||
+ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.MOB); // CraftBukkit // Paper - fix DamageSource API (revert to vanilla, no, just no, don't change this)
|
||||
this.spawnLingeringCloud();
|
||||
this.triggerOnDeathMobEffects(Entity.RemovalReason.KILLED);
|
||||
|
@ -159,10 +175,17 @@ index 60eac9df10a9a395a1568925515d010eb51a64e5..55fd997a4e894eeab24de269d59e4861
|
|||
|
||||
if (flag && entity instanceof LivingEntity entityliving) {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java b/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
|
||||
index ab67c5caaff6e8c7de293b528636f53254b805bd..98e5ec1cc2dba2512650ba706393d1abe0c95591 100644
|
||||
index 5572c50cac4968e3ec75fe1fc98442407bc3b905..3c5e937ade4bbf6a2f5f123ce53001eb915d51eb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
|
||||
@@ -47,7 +47,7 @@ public class CraftDamageSource implements DamageSource {
|
||||
@@ -41,13 +41,13 @@ public class CraftDamageSource implements DamageSource {
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getCausingEntity() {
|
||||
- net.minecraft.world.entity.Entity entity = this.getHandle().getCausingDamager();
|
||||
+ net.minecraft.world.entity.Entity entity = this.getHandle().getCustomEventDamager(); // Paper
|
||||
return (entity != null) ? entity.getBukkitEntity() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getDirectEntity() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue