1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
From 2fdcf26f32ce8995e73577b04c3fa62daed47b0b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 27 Dec 2016 22:38:06 -0500
Subject: [PATCH] Activation Range Improvements
Fixes and adds new Immunities to improve gameplay behavior
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
index fdfe5b9ed..ce3907438 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -10,6 +10,7 @@ public abstract class EntityCreature extends EntityInsentient {
public static final UUID bu = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
public static final AttributeModifier bv = (new AttributeModifier(EntityCreature.bu, "Fleeing speed bonus", 2.0D, 2)).a(false);
+ public BlockPosition movingTarget = null; public BlockPosition getMovingTarget() { return movingTarget; } // Paper
private BlockPosition a;
private float b;
private float c;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index b8ac99e5d..7242da9cc 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -73,7 +73,7 @@ public abstract class EntityLiving extends Entity {
public float aQ;
public float aR;
public EntityHuman killer;
- protected int lastDamageByPlayerTime;
+ public int lastDamageByPlayerTime; // Paper - public
protected boolean aU;
protected int ticksFarFromPlayer;
protected float aW;
diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java
index 13ae7a030..7e3aa6ee6 100644
--- a/src/main/java/net/minecraft/server/EntityLlama.java
+++ b/src/main/java/net/minecraft/server/EntityLlama.java
@@ -363,7 +363,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
return this.bL != null;
}
- public boolean dR() {
+ public boolean inCaravan() { return dR(); } public boolean dR() { // Paper - OBFHELPER
return this.bK != null;
}
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
index ac6e2a9aa..e6c190d43 100644
--- a/src/main/java/net/minecraft/server/EntityVillager.java
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
@@ -20,7 +20,7 @@ public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
private static final Logger bx = LogManager.getLogger();
private static final DataWatcherObject<Integer> by = DataWatcher.a(EntityVillager.class, DataWatcherRegistry.b);
private int profession;
- private boolean bA;
+ private boolean bA;public boolean isMating() { return bA; } // Paper - OBFHELPER
private boolean bB;
Village village;
private EntityHuman tradingPlayer;
diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java
index 83d9c43f3..1cb6652c2 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoal.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoal.java
@@ -18,7 +18,10 @@ public abstract class PathfinderGoal {
public void c() {}
- public void d() {}
+ public void d() {
+ onTaskReset(); // Paper
+ }
+ public void onTaskReset() {} // Paper
public void e() {}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java
index e5b5e9887..e3781f3a8 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java
@@ -2,12 +2,21 @@ package net.minecraft.server;
public abstract class PathfinderGoalGotoTarget extends PathfinderGoal {
- private final EntityCreature c;
+ private final EntityCreature c; public EntityCreature getEntity() { return c; } // Paper - OBFHELPER
private final double d;
protected int a;
private int e;
private int f;
- protected BlockPosition b;
+ protected BlockPosition b; public BlockPosition getTarget() { return b; } public void setTarget(BlockPosition pos) { this.b = pos; getEntity().movingTarget = pos != BlockPosition.ZERO ? pos : null; } // Paper - OBFHELPER
+
+ // Paper start
+ @Override
+ public void onTaskReset() {
+ super.onTaskReset();
+ setTarget(BlockPosition.ZERO);
+ }
+ // Paper end
+
private boolean g;
private final int h;
@@ -69,7 +78,7 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal {
BlockPosition blockposition1 = blockposition.a(l, j - 1, i1);
if (this.c.f(blockposition1) && this.a(this.c.world, blockposition1)) {
- this.b = blockposition1;
+ setTarget(blockposition1); // Paper
return true;
}
}
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
index c8a6ff3d4..428912cbc 100644
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -20,6 +20,7 @@ import net.minecraft.server.EntityFireball;
import net.minecraft.server.EntityFireworks;
import net.minecraft.server.EntityHuman;
import net.minecraft.server.EntityLiving;
+import net.minecraft.server.EntityLlama;
import net.minecraft.server.EntityMonster;
import net.minecraft.server.EntityProjectile;
import net.minecraft.server.EntitySheep;
@@ -210,18 +211,29 @@ public class ActivationRange
if ( entity instanceof EntityLiving )
{
EntityLiving living = (EntityLiving) entity;
- if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTicks > 0 || living.effects.size() > 0 )
+ if ( living.lastDamageByPlayerTime > 0 || living.hurtTicks > 0 || living.effects.size() > 0 ) // Paper
{
return true;
}
- if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).getGoalTarget() != null )
+ if ( entity instanceof EntityCreature )
+ {
+ // Paper start
+ EntityCreature creature = (EntityCreature) entity;
+ if (creature.getGoalTarget() != null || creature.getMovingTarget() != null) {
+ return true;
+ }
+ // Paper end
+ }
+ if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).isMating() ) // Paper
{
return true;
}
- if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).df()/* Getter for first boolean */ )
+ // Paper start
+ if ( entity instanceof EntityLlama && ( (EntityLlama ) entity ).inCaravan() )
{
return true;
}
+ // Paper end
if ( entity instanceof EntityAnimal )
{
EntityAnimal animal = (EntityAnimal) entity;
--
2.12.2.windows.2
|