Fix entities refusing to die and portal search not working

This commit is contained in:
Spottedleaf 2019-05-07 05:00:51 -07:00
parent bc024aec6e
commit c3534f1340
2 changed files with 27 additions and 17 deletions

View file

@ -1,4 +1,4 @@
From 07c480b2091dfcf5cc56db87c01a25f65eb6b0f2 Mon Sep 17 00:00:00 2001
From 0cdb3904fef11c54f90e1e0e323d36b039a0e82e Mon Sep 17 00:00:00 2001
From: Joseph Hirschfeld <joe@ibj.io>
Date: Thu, 3 Mar 2016 02:46:17 -0600
Subject: [PATCH] Add configurable portal search radius
@ -19,7 +19,7 @@ index be91b11242..320fd07c62 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 1685e694ba..e7ca777c16 100644
index 13f80ac832..02e5487efb 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -70,10 +70,11 @@ public class PortalTravelAgent {
@ -28,7 +28,7 @@ index 1685e694ba..e7ca777c16 100644
- for (int i = -128; i <= 128; ++i) {
+ int portalSearchRadius = world.paperConfig.portalSearchRadius; // Paper
+ for (int i = portalSearchRadius; i <= portalSearchRadius; ++i) { // Paper
+ for (int i = -portalSearchRadius; i <= portalSearchRadius; ++i) { // Paper
BlockPosition blockposition2;
- for (int j = -128; j <= 128; ++j) {

View file

@ -1,4 +1,4 @@
From 13f345848bcc1fc092ff857b6a973103b85ad092 Mon Sep 17 00:00:00 2001
From 91e26b7d4f46295ba6b5efd3577a49eeed07b55c Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
Date: Tue, 21 Aug 2018 01:39:35 +0100
Subject: [PATCH] Improve death events
@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using
internal code.
diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java
index 20db76abd..a148cd437 100644
index 20db76abd7..a148cd437c 100644
--- a/src/main/java/net/minecraft/server/CombatTracker.java
+++ b/src/main/java/net/minecraft/server/CombatTracker.java
@@ -175,6 +175,7 @@ public class CombatTracker {
@ -27,7 +27,7 @@ index 20db76abd..a148cd437 100644
int i = this.f ? 300 : 100;
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 9bfc725a2..b406dc523 100644
index 9bfc725a2c..b406dc5232 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1469,6 +1469,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -47,7 +47,7 @@ index 9bfc725a2..b406dc523 100644
protected void i(double d0, double d1, double d2) {
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index 7031dd0e4..f6dc96434 100644
index 7031dd0e4c..f6dc96434b 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -675,7 +675,8 @@ public class EntityArmorStand extends EntityLiving {
@ -61,10 +61,10 @@ index 7031dd0e4..f6dc96434 100644
}
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java
index 917d60350..9ddcc3a89 100644
index 917d603507..c099e2fbb6 100644
--- a/src/main/java/net/minecraft/server/EntityFox.java
+++ b/src/main/java/net/minecraft/server/EntityFox.java
@@ -597,7 +597,7 @@ public class EntityFox extends EntityAnimal {
@@ -597,15 +597,25 @@ public class EntityFox extends EntityAnimal {
}
@Override
@ -72,18 +72,28 @@ index 917d60350..9ddcc3a89 100644
+ protected org.bukkit.event.entity.EntityDeathEvent d(DamageSource damagesource) { // Paper
ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND);
+ // Paper start - Cancellable death event
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.d(damagesource);
+
+ // Below is code to drop
+
+ if (deathEvent == null || deathEvent.isCancelled()) {
+ return deathEvent;
+ }
+ // Paper end
+
if (!itemstack.isEmpty()) {
@@ -605,7 +605,7 @@ public class EntityFox extends EntityAnimal {
this.a(itemstack);
this.setSlot(EnumItemSlot.MAINHAND, ItemStack.a);
}
- super.d(damagesource);
+ return super.d(damagesource); // Paper
+ return deathEvent; // Paper
}
public static boolean a(EntityFox entityfox, EntityLiving entityliving) {
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 78b7ab59b..4f7ebe364 100644
index 78b7ab59b9..88cb1ac8f0 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -85,7 +85,7 @@ public abstract class EntityLiving extends Entity {
@ -160,7 +170,7 @@ index 78b7ab59b..4f7ebe364 100644
if (!this.world.isClientSide) {
- this.d(damagesource);
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = this.d(damagesource);
+ if (deathEvent == null || deathEvent.isCancelled()) {
+ if (deathEvent == null || !deathEvent.isCancelled()) {
+ if (this.getKillCount() >= 0 && entityliving != null) {
+ entityliving.runKillTrigger(this, this.getKillCount(), damagesource);
+ }
@ -238,7 +248,7 @@ index 78b7ab59b..4f7ebe364 100644
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 870ef557a..a3f5919fe 100644
index 870ef557a2..a3f5919fe8 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -75,6 +75,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -289,7 +299,7 @@ index 870ef557a..a3f5919fe 100644
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
index 73cb64e09..9f317ff2e 100644
index 73cb64e09d..9f317ff2e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -806,6 +806,22 @@ public enum CraftSound {
@ -316,7 +326,7 @@ index 73cb64e09..9f317ff2e 100644
this.minecraftKey = minecraftKey;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 53d61790c..6a390c114 100644
index 53d61790c5..6a390c1146 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1713,7 +1713,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -337,7 +347,7 @@ index 53d61790c..6a390c114 100644
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 23c4b9346..aafd71d65 100644
index 23c4b93466..aafd71d65c 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -720,9 +720,16 @@ public class CraftEventFactory {