Add xp orb spawn reason for frogs (#8045)

This commit is contained in:
Lulu13022002 2022-07-07 23:38:12 +02:00 committed by GitHub
parent 6ea73e7d63
commit c4782f50a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 10 deletions

View File

@ -192,6 +192,19 @@ index 8760e4199a1c8ae1a784f885923616f3740fe120..bb2be6eea7a0cff4cc70bd43738b1ce2
return instance.group(RecordCodecBuilder.point(updateListener), Codec.BOOL.optionalFieldOf("Valid", Boolean.valueOf(false)).forGetter((poiSet) -> {
return poiSet.isValid;
}), PoiRecord.codec(updateListener).listOf().fieldOf("Records").forGetter((poiSet) -> {
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index 01f8d11ee4441a1c4d87427e3f9bcd7155259a5b..fe660bbaa4113fb2ffa1ea2f10e4e1e674fbb86d 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -105,7 +105,7 @@ public class Frog extends Animal {
@Override
public Brain<Frog> getBrain() {
- return super.getBrain();
+ return (Brain<Frog>) super.getBrain(); // Paper - decompile fix
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 64314cf4dc53a1a0a5f676fa00503858e0120dfa..45741410a13cffe3419e34b5607b048bbcf1c3ff 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java

View File

@ -21,10 +21,10 @@ index cd3b4c97374d44f5a0e710e03f4ac38938757e25..b18bb06caf5f034dffbb72120c8f21da
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 b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2d7524542 100644
index b3433ce9c722bdab81848a6c2d121ca510c48509..16a1a005f2dda30cf804bf51638383ef3bfeb43e 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -37,13 +37,63 @@ public class ExperienceOrb extends Entity {
@@ -37,13 +37,65 @@ public class ExperienceOrb extends Entity {
public int value;
private int count;
private Player followingPlayer;
@ -67,6 +67,8 @@ index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2
+ 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);
+ }
@ -90,7 +92,7 @@ index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2
}
public ExperienceOrb(EntityType<? extends ExperienceOrb> type, Level world) {
@@ -153,12 +203,20 @@ public class ExperienceOrb extends Entity {
@@ -153,12 +205,20 @@ public class ExperienceOrb extends Entity {
}
public static void award(ServerLevel world, Vec3 pos, int amount) {
@ -112,7 +114,7 @@ index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2
}
}
@@ -228,6 +286,7 @@ public class ExperienceOrb extends Entity {
@@ -228,6 +288,7 @@ public class ExperienceOrb extends Entity {
nbt.putShort("Age", (short) this.age);
nbt.putShort("Value", (short) this.value);
nbt.putInt("Count", this.count);
@ -120,7 +122,7 @@ index b3433ce9c722bdab81848a6c2d121ca510c48509..227aca795efc99c4f81dfb30c00d31d2
}
@Override
@@ -236,6 +295,7 @@ public class ExperienceOrb extends Entity {
@@ -236,6 +297,7 @@ public class ExperienceOrb extends Entity {
this.age = nbt.getShort("Age");
this.value = nbt.getShort("Value");
this.count = Math.max(nbt.getInt("Count"), 1);
@ -181,6 +183,19 @@ index 7c90063be2a7eb66b7f0981059018f20413256c6..37125ffe47fcd5fe93ab62ad8a46e818
}
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index fe660bbaa4113fb2ffa1ea2f10e4e1e674fbb86d..bb6063ae7f4438916306ce876057f7488537b444 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -274,7 +274,7 @@ public class Frog extends Animal {
this.getBrain().setMemory(MemoryModuleType.IS_PREGNANT, Unit.INSTANCE);
world.broadcastEntityEvent(this, (byte)18);
if (world.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
- world.addFreshEntity(new ExperienceOrb(world, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1));
+ world.addFreshEntity(new ExperienceOrb(world, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, serverPlayer)); // 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 0dff7a47ecac1916ad23739fbb06ddd0f0052a65..d0ebcc23d863be630b55245aa2604c108ee6c93a 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java

View File

@ -6,10 +6,10 @@ Subject: [PATCH] PlayerPickupExperienceEvent
Allows plugins to cancel a player picking up an experience orb
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index 227aca795efc99c4f81dfb30c00d31d2d7524542..6bf6d6629dfb9338d3e34f433a5698904a2acdad 100644
index 16a1a005f2dda30cf804bf51638383ef3bfeb43e..80f4dfdbc410aa3346897e2ca63272a081712b6e 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -301,7 +301,7 @@ public class ExperienceOrb extends Entity {
@@ -303,7 +303,7 @@ public class ExperienceOrb extends Entity {
@Override
public void playerTouch(Player player) {
if (!this.level.isClientSide) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] MC-135506: Experience should save as Integers
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
index 6bf6d6629dfb9338d3e34f433a5698904a2acdad..4848f26a006f4d4df620ded526134b3b39e90d29 100644
index 80f4dfdbc410aa3346897e2ca63272a081712b6e..d6527396939d9a1dd2f1cfb6cb66dc64fa0e5332 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
@@ -284,7 +284,7 @@ public class ExperienceOrb extends Entity {
@@ -286,7 +286,7 @@ public class ExperienceOrb extends Entity {
public void addAdditionalSaveData(CompoundTag nbt) {
nbt.putShort("Health", (short) this.health);
nbt.putShort("Age", (short) this.age);
@ -17,7 +17,7 @@ index 6bf6d6629dfb9338d3e34f433a5698904a2acdad..4848f26a006f4d4df620ded526134b3b
nbt.putInt("Count", this.count);
this.savePaperNBT(nbt); // Paper
}
@@ -293,7 +293,7 @@ public class ExperienceOrb extends Entity {
@@ -295,7 +295,7 @@ public class ExperienceOrb extends Entity {
public void readAdditionalSaveData(CompoundTag nbt) {
this.health = nbt.getShort("Health");
this.age = nbt.getShort("Age");