mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-08 08:02:13 -07:00
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:
@@ -14,7 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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
|
||||
|
||||
@@ -26,23 +27,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
- 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;
|
||||
@@ -114,7 +130,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
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);
|
||||
@@ -164,6 +180,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/damage/CraftDamageSource.java
|
||||
@@ -0,0 +0,0 @@ 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() {
|
||||
- net.minecraft.world.entity.Entity entity = this.getHandle().getDamager();
|
||||
|
Reference in New Issue
Block a user