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 5a6ef6ed50
commit 71b1db46b1
2 changed files with 24 additions and 14 deletions

View file

@ -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 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 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -0,0 +0,0 @@ public class PortalTravelAgent { @@ -0,0 +0,0 @@ public class PortalTravelAgent {
@ -28,7 +28,7 @@ index 1685e694ba..e7ca777c16 100644
- for (int i = -128; i <= 128; ++i) { - for (int i = -128; i <= 128; ++i) {
+ int portalSearchRadius = world.paperConfig.portalSearchRadius; // Paper + int portalSearchRadius = world.paperConfig.portalSearchRadius; // Paper
+ for (int i = portalSearchRadius; i <= portalSearchRadius; ++i) { // Paper + for (int i = -portalSearchRadius; i <= portalSearchRadius; ++i) { // Paper
BlockPosition blockposition2; BlockPosition blockposition2;
- for (int j = -128; j <= 128; ++j) { - for (int j = -128; j <= 128; ++j) {

View file

@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using
internal code. internal code.
diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java 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 --- a/src/main/java/net/minecraft/server/CombatTracker.java
+++ b/src/main/java/net/minecraft/server/CombatTracker.java +++ b/src/main/java/net/minecraft/server/CombatTracker.java
@@ -0,0 +0,0 @@ public class CombatTracker { @@ -0,0 +0,0 @@ public class CombatTracker {
@ -27,7 +27,7 @@ index 20db76abd..a148cd437 100644
int i = this.f ? 300 : 100; 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 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 --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -0,0 +0,0 @@ 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) { 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 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 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
@ -61,7 +61,7 @@ index 7031dd0e4..f6dc96434 100644
} }
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java 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 --- a/src/main/java/net/minecraft/server/EntityFox.java
+++ b/src/main/java/net/minecraft/server/EntityFox.java +++ b/src/main/java/net/minecraft/server/EntityFox.java
@@ -0,0 +0,0 @@ public class EntityFox extends EntityAnimal { @@ -0,0 +0,0 @@ public class EntityFox extends EntityAnimal {
@ -72,18 +72,28 @@ index 917d60350..9ddcc3a89 100644
+ protected org.bukkit.event.entity.EntityDeathEvent d(DamageSource damagesource) { // Paper + protected org.bukkit.event.entity.EntityDeathEvent d(DamageSource damagesource) { // Paper
ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND); 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()) { if (!itemstack.isEmpty()) {
@@ -0,0 +0,0 @@ public class EntityFox extends EntityAnimal { this.a(itemstack);
this.setSlot(EnumItemSlot.MAINHAND, ItemStack.a); this.setSlot(EnumItemSlot.MAINHAND, ItemStack.a);
} }
- super.d(damagesource); - super.d(damagesource);
+ return super.d(damagesource); // Paper + return deathEvent; // Paper
} }
public static boolean a(EntityFox entityfox, EntityLiving entityliving) { 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 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 --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
@ -160,7 +170,7 @@ index 78b7ab59b..4f7ebe364 100644
if (!this.world.isClientSide) { if (!this.world.isClientSide) {
- this.d(damagesource); - this.d(damagesource);
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = 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) { + if (this.getKillCount() >= 0 && entityliving != null) {
+ entityliving.runKillTrigger(this, this.getKillCount(), damagesource); + 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; 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 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 --- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -0,0 +0,0 @@ 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 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 --- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -0,0 +0,0 @@ public enum CraftSound { @@ -0,0 +0,0 @@ public enum CraftSound {
@ -316,7 +326,7 @@ index 73cb64e09..9f317ff2e 100644
this.minecraftKey = minecraftKey; 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 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 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -337,7 +347,7 @@ index 53d61790c..6a390c114 100644
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) { 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 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 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -0,0 +0,0 @@ public class CraftEventFactory { @@ -0,0 +0,0 @@ public class CraftEventFactory {