mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-30 04:02:50 +01:00
9df2066642
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: dfe1fb48 PR-906: Add missing MinecraftExperimental annotation to Bundles 825ab30d PR-905: Add missing MapCursor.Type and update documentation e03d10e6 PR-903: Make BARRIER Waterlogged 1961ead6 PR-898: Use Java Consumer instead of Bukkit Consumer CraftBukkit Changes: f71a799f0 Make BARRIER Waterlogged 172f76a45 Upgrade specialsource-maven-plugin f0702775c SPIGOT-7486: Alternate approach to null profile names 069495671 SPIGOT-7485: Allow air entity items since required for Vanilla logic 5dfd33dc2 SPIGOT-7484: Cancelling PlayerEditBookEvent does not update client's book contents 02d490788 PR-1250: Standardize and centralize Bukkit / Minecraft registry conversion 9024a09b9 PR-1251: Use Java Consumer instead of Bukkit Consumer 6d4b25bf1 Increase diff stability
361 lines
23 KiB
Diff
361 lines
23 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Tue, 19 Dec 2017 16:31:46 -0500
|
|
Subject: [PATCH] ExperienceOrbs API for Reason/Source/Triggering player
|
|
|
|
Adds lots of information about why this orb exists.
|
|
|
|
Replaces isFromBottle() with logic that persists entity reloads too.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
index 4814601e549b0b96e83ed64ee094ddaa825565de..16468dfd657501f6fd5eefa4c32682e24eaba22d 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
|
|
@@ -427,7 +427,7 @@ public class ServerPlayerGameMode {
|
|
|
|
// Drop event experience
|
|
if (flag && event != null) {
|
|
- iblockdata.getBlock().popExperience(this.level, pos, event.getExpToDrop());
|
|
+ iblockdata.getBlock().popExperience(this.level, pos, event.getExpToDrop(), this.player); // Paper
|
|
}
|
|
|
|
return true;
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
index 9dffdfe5bbd0517e9a2c6a6770eea07b43ef9b33..6de7fcccb6da757185a38b79b3a22821b1186201 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
@@ -39,13 +39,67 @@ public class ExperienceOrb extends Entity {
|
|
public int value;
|
|
private int count;
|
|
private Player followingPlayer;
|
|
+ // Paper start
|
|
+ @javax.annotation.Nullable
|
|
+ public java.util.UUID sourceEntityId;
|
|
+ @javax.annotation.Nullable
|
|
+ public java.util.UUID triggerEntityId;
|
|
+ public org.bukkit.entity.ExperienceOrb.SpawnReason spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN;
|
|
+
|
|
+ private void loadPaperNBT(CompoundTag nbttagcompound) {
|
|
+ if (!nbttagcompound.contains("Paper.ExpData", 10)) { // 10 = compound
|
|
+ return;
|
|
+ }
|
|
+ CompoundTag comp = nbttagcompound.getCompound("Paper.ExpData");
|
|
+ if (comp.hasUUID("source")) {
|
|
+ this.sourceEntityId = comp.getUUID("source");
|
|
+ }
|
|
+ if (comp.hasUUID("trigger")) {
|
|
+ this.triggerEntityId = comp.getUUID("trigger");
|
|
+ }
|
|
+ if (comp.contains("reason")) {
|
|
+ String reason = comp.getString("reason");
|
|
+ try {
|
|
+ this.spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.valueOf(reason);
|
|
+ } catch (Exception e) {
|
|
+ this.level().getCraftServer().getLogger().warning("Invalid spawnReason set for experience orb: " + e.getMessage() + " - " + reason);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ private void savePaperNBT(CompoundTag nbttagcompound) {
|
|
+ CompoundTag comp = new CompoundTag();
|
|
+ if (this.sourceEntityId != null) {
|
|
+ comp.putUUID("source", this.sourceEntityId);
|
|
+ }
|
|
+ if (this.triggerEntityId != null) {
|
|
+ comp.putUUID("trigger", triggerEntityId);
|
|
+ }
|
|
+ if (this.spawnReason != null && this.spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) {
|
|
+ comp.putString("reason", this.spawnReason.name());
|
|
+ }
|
|
+ nbttagcompound.put("Paper.ExpData", comp);
|
|
+ }
|
|
|
|
+ @io.papermc.paper.annotation.DoNotUse
|
|
+ @Deprecated
|
|
public ExperienceOrb(Level world, double x, double y, double z, int amount) {
|
|
+ this(world, x, y, z, amount, null, null);
|
|
+ }
|
|
+
|
|
+ public ExperienceOrb(Level world, double d0, double d1, double d2, int i, @javax.annotation.Nullable org.bukkit.entity.ExperienceOrb.SpawnReason reason, @javax.annotation.Nullable Entity triggerId) {
|
|
+ this(world, d0, d1, d2, i, reason, triggerId, null);
|
|
+ }
|
|
+
|
|
+ public ExperienceOrb(Level world, double d0, double d1, double d2, int i, @javax.annotation.Nullable org.bukkit.entity.ExperienceOrb.SpawnReason reason, @javax.annotation.Nullable Entity triggerId, @javax.annotation.Nullable Entity sourceId) {
|
|
this(EntityType.EXPERIENCE_ORB, world);
|
|
- this.setPos(x, y, z);
|
|
+ this.sourceEntityId = sourceId != null ? sourceId.getUUID() : null;
|
|
+ this.triggerEntityId = triggerId != null ? triggerId.getUUID() : null;
|
|
+ this.spawnReason = reason != null ? reason : org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN;
|
|
+ // Paper end
|
|
+ this.setPos(d0, d1, d2);
|
|
this.setYRot((float) (this.random.nextDouble() * 360.0D));
|
|
this.setDeltaMovement((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D);
|
|
- this.value = amount;
|
|
+ this.value = i;
|
|
}
|
|
|
|
public ExperienceOrb(EntityType<? extends ExperienceOrb> type, Level world) {
|
|
@@ -160,12 +214,20 @@ public class ExperienceOrb extends Entity {
|
|
}
|
|
|
|
public static void award(ServerLevel world, Vec3 pos, int amount) {
|
|
+ // Paper start - add reasons for orbs
|
|
+ award(world, pos, amount, null, null, null);
|
|
+ }
|
|
+ public static void award(ServerLevel world, Vec3 pos, int amount, org.bukkit.entity.ExperienceOrb.SpawnReason reason, Entity triggerId) {
|
|
+ award(world, pos, amount, reason, triggerId, null);
|
|
+ }
|
|
+ public static void award(ServerLevel world, Vec3 pos, int amount, org.bukkit.entity.ExperienceOrb.SpawnReason reason, Entity triggerId, Entity sourceId) {
|
|
+ // Paper end - add reasons for orbs
|
|
while (amount > 0) {
|
|
int j = ExperienceOrb.getExperienceValue(amount);
|
|
|
|
amount -= j;
|
|
if (!ExperienceOrb.tryMergeToExisting(world, pos, j)) {
|
|
- world.addFreshEntity(new ExperienceOrb(world, pos.x(), pos.y(), pos.z(), j));
|
|
+ world.addFreshEntity(new ExperienceOrb(world, pos.x(), pos.y(), pos.z(), j, reason, triggerId, sourceId)); // Paper - add reason
|
|
}
|
|
}
|
|
|
|
@@ -235,6 +297,7 @@ public class ExperienceOrb extends Entity {
|
|
nbt.putShort("Age", (short) this.age);
|
|
nbt.putShort("Value", (short) this.value);
|
|
nbt.putInt("Count", this.count);
|
|
+ this.savePaperNBT(nbt); // Paper
|
|
}
|
|
|
|
@Override
|
|
@@ -243,6 +306,7 @@ public class ExperienceOrb extends Entity {
|
|
this.age = nbt.getShort("Age");
|
|
this.value = nbt.getShort("Value");
|
|
this.count = Math.max(nbt.getInt("Count"), 1);
|
|
+ this.loadPaperNBT(nbt); // Paper
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index c61ddc868fa2eed1dce72ebcf98940756cca401e..45d1b869b0aa2d12000a58c5c3cd1c8232429d36 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1792,7 +1792,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
protected void dropExperience() {
|
|
// CraftBukkit start - Update getExpReward() above if the removed if() changes!
|
|
if (true && !(this instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
|
|
- ExperienceOrb.award((ServerLevel) this.level(), this.position(), this.expToDrop);
|
|
+ LivingEntity attacker = this.lastHurtByPlayer != null ? this.lastHurtByPlayer : this.lastHurtByMob; // Paper
|
|
+ ExperienceOrb.award((ServerLevel) this.level(), this.position(), this.expToDrop, this instanceof ServerPlayer ? org.bukkit.entity.ExperienceOrb.SpawnReason.PLAYER_DEATH : org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, attacker, this); // Paper
|
|
this.expToDrop = 0;
|
|
}
|
|
// CraftBukkit end
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Animal.java b/src/main/java/net/minecraft/world/entity/animal/Animal.java
|
|
index b5b93396166202cbe5a4456794fd394de932262a..be105a4460e9bf2ef4b72a307fa31291c37d5e0e 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Animal.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Animal.java
|
|
@@ -256,12 +256,14 @@ public abstract class Animal extends AgeableMob {
|
|
|
|
public void finalizeSpawnChildFromBreeding(ServerLevel worldserver, Animal entityanimal, @Nullable AgeableMob entityageable, int experience) {
|
|
// CraftBukkit end
|
|
- Optional.ofNullable(this.getLoveCause()).or(() -> {
|
|
- return Optional.ofNullable(entityanimal.getLoveCause());
|
|
- }).ifPresent((entityplayer) -> {
|
|
+ // Paper start
|
|
+ ServerPlayer entityplayer = this.getLoveCause();
|
|
+ if (entityplayer == null) entityplayer = entityanimal.getLoveCause();
|
|
+ if (entityplayer != null) {
|
|
+ // Paper end
|
|
entityplayer.awardStat(Stats.ANIMALS_BRED);
|
|
CriteriaTriggers.BRED_ANIMALS.trigger(entityplayer, this, entityanimal, entityageable);
|
|
- });
|
|
+ } // Paper
|
|
this.setAge(6000);
|
|
entityanimal.setAge(6000);
|
|
this.resetLove();
|
|
@@ -270,7 +272,7 @@ public abstract class Animal extends AgeableMob {
|
|
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
|
// CraftBukkit start - use event experience
|
|
if (experience > 0) {
|
|
- worldserver.addFreshEntity(new ExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), experience));
|
|
+ worldserver.addFreshEntity(new ExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
index 1bf6126b38dd127bb72b174b049fb3b396db713c..0d4b86411d2d064b04334b508b1cb65695afaebd 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
|
@@ -909,7 +909,7 @@ public class Fox extends Animal implements VariantHolder<Fox.Type> {
|
|
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
|
// CraftBukkit start - use event experience
|
|
if (experience > 0) {
|
|
- this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), experience));
|
|
+ this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityfox)); // Paper
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
|
index 6dba24f47ca76a432a836178af178c2d52631eee..ed1f6e77d5fc9b6f5f52b1a10275783b514c162c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
|
@@ -464,7 +464,7 @@ public class Turtle extends Animal {
|
|
RandomSource randomsource = this.animal.getRandom();
|
|
|
|
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
|
- this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomsource.nextInt(7) + 1));
|
|
+ this.level.addFreshEntity(new ExperienceOrb(this.level, this.animal.getX(), this.animal.getY(), this.animal.getZ(), randomsource.nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer)); // Paper;
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
index 1a787bd4bdbbf7c78f4bf6bd7e2f36540fec7d50..8bfb2f94226e6b623def141a7af79d0f46d7d445 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
|
|
@@ -673,7 +673,7 @@ public class EnderDragon extends Mob implements Enemy {
|
|
|
|
if (this.level() instanceof ServerLevel) {
|
|
if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
|
- ExperienceOrb.award((ServerLevel) this.level(), this.position(), Mth.floor((float) short0 * 0.08F));
|
|
+ ExperienceOrb.award((ServerLevel) this.level(), this.position(), Mth.floor((float) short0 * 0.08F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.lastHurtByPlayer, this); // Paper
|
|
}
|
|
|
|
if (this.dragonDeathTime == 1 && !this.isSilent()) {
|
|
@@ -701,7 +701,7 @@ public class EnderDragon extends Mob implements Enemy {
|
|
this.move(MoverType.SELF, new Vec3(0.0D, 0.10000000149011612D, 0.0D));
|
|
if (this.dragonDeathTime == 200 && this.level() instanceof ServerLevel) {
|
|
if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
|
- ExperienceOrb.award((ServerLevel) this.level(), this.position(), Mth.floor((float) short0 * 0.2F));
|
|
+ ExperienceOrb.award((ServerLevel) this.level(), this.position(), Mth.floor((float) short0 * 0.2F), org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.lastHurtByPlayer, this); // Paper
|
|
}
|
|
|
|
if (this.dragonFight != null) {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
|
index b70ee1dff0442de32a9e20ad54b246d5eae45e58..b3127238cea62c47d710abab44f6570103ba9364 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
|
@@ -638,7 +638,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
|
}
|
|
|
|
if (offer.shouldRewardExp()) {
|
|
- this.level().addFreshEntity(new ExperienceOrb(this.level(), this.getX(), this.getY() + 0.5D, this.getZ(), i));
|
|
+ this.level().addFreshEntity(new ExperienceOrb(this.level(), this.getX(), this.getY() + 0.5D, this.getZ(), i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTradingPlayer(), this)); // Paper
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
|
|
index eb15d694ad8c24b659feba53e6992661ba1a9b76..5ea5f424c55f60bf63d3a4d3fe51362939f42f4c 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/npc/WanderingTrader.java
|
|
@@ -207,7 +207,7 @@ public class WanderingTrader extends net.minecraft.world.entity.npc.AbstractVill
|
|
if (offer.shouldRewardExp()) {
|
|
int i = 3 + this.random.nextInt(4);
|
|
|
|
- this.level().addFreshEntity(new ExperienceOrb(this.level(), this.getX(), this.getY() + 0.5D, this.getZ(), i));
|
|
+ this.level().addFreshEntity(new ExperienceOrb(this.level(), this.getX(), this.getY() + 0.5D, this.getZ(), i, org.bukkit.entity.ExperienceOrb.SpawnReason.VILLAGER_TRADE, this.getTradingPlayer(), this)); // Paper
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
|
index af6829c25fcd186adc3575d50cab6d46db9a2fac..5c77992e0c49eb217dd66657b35164225b400518 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
|
@@ -522,7 +522,7 @@ public class FishingHook extends Projectile {
|
|
this.level().addFreshEntity(entityitem);
|
|
// CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop()
|
|
if (playerFishEvent.getExpToDrop() > 0) {
|
|
- entityhuman.level().addFreshEntity(new ExperienceOrb(entityhuman.level(), entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, playerFishEvent.getExpToDrop()));
|
|
+ entityhuman.level().addFreshEntity(new ExperienceOrb(entityhuman.level(), entityhuman.getX(), entityhuman.getY() + 0.5D, entityhuman.getZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getPlayerOwner(), this)); // Paper
|
|
}
|
|
// CraftBukkit end
|
|
if (itemstack1.is(ItemTags.FISHES)) {
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
|
|
index 2191af62f4202413738542d738456ca71febdbf4..5b3059460d4b18d984483d655526d83204fb1c73 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownExperienceBottle.java
|
|
@@ -51,7 +51,7 @@ public class ThrownExperienceBottle extends ThrowableItemProjectile {
|
|
}
|
|
// CraftBukkit end
|
|
|
|
- ExperienceOrb.award((ServerLevel) this.level(), this.position(), i);
|
|
+ ExperienceOrb.award((ServerLevel) this.level(), this.position(), i, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, this.getOwner(), this); // Paper
|
|
this.discard();
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
|
index c858b987cb6f92cc6fa705bbe1ae11a720eb242c..2c263447aa8853f18d1c1d476b49a47f6e9ca2ad 100644
|
|
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
|
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
|
@@ -97,7 +97,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
|
|
public void onTake(net.minecraft.world.entity.player.Player player, ItemStack stack) {
|
|
context.execute((world, blockposition) -> {
|
|
if (world instanceof ServerLevel) {
|
|
- ExperienceOrb.award((ServerLevel) world, Vec3.atCenterOf(blockposition), this.getExperienceAmount(world));
|
|
+ ExperienceOrb.award((ServerLevel) world, Vec3.atCenterOf(blockposition), this.getExperienceAmount(world), org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, player); // Paper
|
|
}
|
|
|
|
world.levelEvent(1042, blockposition, 0);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
|
index 7ed82beb538a25a5246f6288c1dddb4f5f85e997..7646b66bc5ba0288608de0d836c7307e02eebe67 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
|
@@ -362,8 +362,13 @@ public class Block extends BlockBehaviour implements ItemLike {
|
|
}
|
|
|
|
public void popExperience(ServerLevel world, BlockPos pos, int size) {
|
|
+ // Paper start - add player parameter
|
|
+ popExperience(world, pos, size, null);
|
|
+ }
|
|
+ public void popExperience(ServerLevel world, BlockPos pos, int size, net.minecraft.server.level.ServerPlayer player) {
|
|
+ // Paper end - add player parameter
|
|
if (world.getGameRules().getBoolean(GameRules.RULE_DOBLOCKDROPS)) {
|
|
- ExperienceOrb.award(world, Vec3.atCenterOf(pos), size);
|
|
+ ExperienceOrb.award(world, Vec3.atCenterOf(pos), size, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player); // Paper
|
|
}
|
|
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
index e72ed2ed8664cbc408cbe1e38f1f0acacc3841dd..2f628f36c32752d1bac910e180b90639c1ae2c9d 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
@@ -650,7 +650,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
|
j = event.getExpToDrop();
|
|
// CraftBukkit end
|
|
|
|
- ExperienceOrb.award(worldserver, vec3d, j);
|
|
+ ExperienceOrb.award(worldserver, vec3d, j, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, entityhuman); // Paper
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
index 8beb4670fffa2df0a9bd64ebb8810b25ce670f16..134b138abdf17fae340226ecac3868ad7a993086 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
@@ -943,7 +943,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
|
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
|
|
entity = new PrimedTnt(world, x, y, z, null);
|
|
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
|
|
- entity = new net.minecraft.world.entity.ExperienceOrb(world, x, y, z, 0);
|
|
+ entity = new net.minecraft.world.entity.ExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper
|
|
} else if (LightningStrike.class.isAssignableFrom(clazz)) {
|
|
entity = net.minecraft.world.entity.EntityType.LIGHTNING_BOLT.create(world);
|
|
entity.moveTo(location.getX(), location.getY(), location.getZ());
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
|
index 4907d61b0254919e137c4f92e0dbeb2d61a906f6..26c795983515580b30b5ef8c701faa95ab1aea8e 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java
|
|
@@ -18,6 +18,18 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb {
|
|
this.getHandle().value = value;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ public java.util.UUID getTriggerEntityId() {
|
|
+ return getHandle().triggerEntityId;
|
|
+ }
|
|
+ public java.util.UUID getSourceEntityId() {
|
|
+ return getHandle().sourceEntityId;
|
|
+ }
|
|
+ public SpawnReason getSpawnReason() {
|
|
+ return getHandle().spawnReason;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public net.minecraft.world.entity.ExperienceOrb getHandle() {
|
|
return (net.minecraft.world.entity.ExperienceOrb) entity;
|