mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 02:17:35 +01:00
094bb03a37
- Lots of itemstack cloning removed. Only clone if the item is actually moved - Return true when a plugin cancels inventory move item event instead of false, as false causes pulls to cycle through all items. However, pushes do not exhibit the same behavior, so this is not something plugins could of been relying on. - Add option (Default on) to cooldown hoppers when they fail to move an item due to full inventory - Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
146 lines
6.3 KiB
Diff
146 lines
6.3 KiB
Diff
From a55ca73274add9eb9693ca1952c8e563341902f9 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 0c82c6f5b..9659a45ef 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 bv = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
|
|
public static final AttributeModifier bw = (new AttributeModifier(EntityCreature.bv, "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 final float c;
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index f76be4da0..3cd37f28d 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 dbda68dd0..af49b7273 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLlama.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLlama.java
|
|
@@ -363,6 +363,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn
|
|
return this.bM != null;
|
|
}
|
|
|
|
+ public boolean inCaravan() { return this.dW(); } // Paper - OBFHELPER
|
|
public boolean dW() {
|
|
return this.bL != null;
|
|
}
|
|
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 47865c027..b08564618 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 )
|
|
{
|
|
- return true;
|
|
+ // Paper start
|
|
+ EntityCreature creature = (EntityCreature) entity;
|
|
+ if (creature.getGoalTarget() != null || creature.getMovingTarget() != null) {
|
|
+ return true;
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).isInLove() )
|
|
{
|
|
return true;
|
|
}
|
|
+ // Paper start
|
|
+ if ( entity instanceof EntityLlama && ( (EntityLlama ) entity ).inCaravan() )
|
|
+ {
|
|
+ return true;
|
|
+ }
|
|
+ // Paper end
|
|
if ( entity instanceof EntityAnimal )
|
|
{
|
|
EntityAnimal animal = (EntityAnimal) entity;
|
|
--
|
|
2.16.1
|
|
|