mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
Fix riding non-ridables stopping mob AI
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
From 1f53023bd79aaa06b926af92a6e56b5d703aba64 Mon Sep 17 00:00:00 2001
|
From fb9dfc65c23a81909d5b38da1387b7700e69cd1a Mon Sep 17 00:00:00 2001
|
||||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||||
Date: Tue, 30 Apr 2019 19:17:21 -0500
|
Date: Tue, 30 Apr 2019 19:17:21 -0500
|
||||||
Subject: [PATCH] Integrate ridables
|
Subject: [PATCH] Integrate ridables
|
||||||
|
|
||||||
---
|
---
|
||||||
.../server/ControllerLookDolphin.java | 4 +-
|
.../server/ControllerLookDolphin.java | 4 +-
|
||||||
.../java/net/minecraft/server/Entity.java | 28 ++++-
|
.../java/net/minecraft/server/Entity.java | 31 ++++-
|
||||||
.../net/minecraft/server/EntityAgeable.java | 2 +-
|
.../net/minecraft/server/EntityAgeable.java | 2 +-
|
||||||
.../java/net/minecraft/server/EntityBat.java | 22 ++++
|
.../java/net/minecraft/server/EntityBat.java | 22 ++++
|
||||||
.../net/minecraft/server/EntityBlaze.java | 15 ++-
|
.../net/minecraft/server/EntityBlaze.java | 15 ++-
|
||||||
@@ -31,7 +31,7 @@ Subject: [PATCH] Integrate ridables
|
|||||||
.../net/minecraft/server/EntityHuman.java | 14 ++-
|
.../net/minecraft/server/EntityHuman.java | 14 ++-
|
||||||
.../server/EntityIllagerIllusioner.java | 3 +
|
.../server/EntityIllagerIllusioner.java | 3 +
|
||||||
.../minecraft/server/EntityIllagerWizard.java | 3 +
|
.../minecraft/server/EntityIllagerWizard.java | 3 +
|
||||||
.../minecraft/server/EntityInsentient.java | 52 +++++++-
|
.../minecraft/server/EntityInsentient.java | 51 +++++++-
|
||||||
.../net/minecraft/server/EntityIronGolem.java | 1 +
|
.../net/minecraft/server/EntityIronGolem.java | 1 +
|
||||||
.../net/minecraft/server/EntityLiving.java | 25 +++-
|
.../net/minecraft/server/EntityLiving.java | 25 +++-
|
||||||
.../net/minecraft/server/EntityMagmaCube.java | 3 +-
|
.../net/minecraft/server/EntityMagmaCube.java | 3 +-
|
||||||
@@ -134,7 +134,7 @@ Subject: [PATCH] Integrate ridables
|
|||||||
.../controller/ControllerMoveWASDWater.java | 42 +++++++
|
.../controller/ControllerMoveWASDWater.java | 42 +++++++
|
||||||
.../craftbukkit/entity/CraftLivingEntity.java | 10 ++
|
.../craftbukkit/entity/CraftLivingEntity.java | 10 ++
|
||||||
.../bukkit/craftbukkit/entity/CraftMob.java | 12 ++
|
.../bukkit/craftbukkit/entity/CraftMob.java | 12 ++
|
||||||
130 files changed, 1235 insertions(+), 106 deletions(-)
|
130 files changed, 1236 insertions(+), 107 deletions(-)
|
||||||
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java
|
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java
|
||||||
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java
|
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java
|
||||||
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java
|
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java
|
||||||
@@ -163,7 +163,7 @@ index 454627f65e..df3d6cf281 100644
|
|||||||
this.d = false;
|
this.d = false;
|
||||||
this.a.aM = this.a(this.a.aM, this.h() + 20.0F, this.b);
|
this.a.aM = this.a(this.a.aM, this.h() + 20.0F, this.b);
|
||||||
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 352b6dfb3e..a0e66b7d09 100644
|
index 352b6dfb3e..f78d721941 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
|
||||||
@@ -78,6 +78,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -78,6 +78,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
@@ -174,15 +174,17 @@ index 352b6dfb3e..a0e66b7d09 100644
|
|||||||
Throwable addedToWorldStack; // Paper - entity debug
|
Throwable addedToWorldStack; // Paper - entity debug
|
||||||
public CraftEntity getBukkitEntity() {
|
public CraftEntity getBukkitEntity() {
|
||||||
if (bukkitEntity == null) {
|
if (bukkitEntity == null) {
|
||||||
@@ -101,6 +102,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -100,7 +101,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
|
private final EntityTypes<?> f;
|
||||||
private int id;
|
private int id;
|
||||||
public boolean i; public final boolean blocksEntitySpawning() { return this.i; } // Paper - OBFHELPER
|
public boolean i; public final boolean blocksEntitySpawning() { return this.i; } // Paper - OBFHELPER
|
||||||
|
+ public boolean isRidable = false;// Purpur
|
||||||
public final List<Entity> passengers;
|
public final List<Entity> passengers;
|
||||||
+ private EntityHuman rider; public EntityHuman getRider() { return rider; } // Purpur
|
+ private EntityHuman rider; public EntityHuman getRider() { return rider; } // Purpur
|
||||||
protected int j;
|
protected int j;
|
||||||
private Entity vehicle;
|
private Entity vehicle;
|
||||||
public boolean attachedToPlayer;
|
public boolean attachedToPlayer;
|
||||||
@@ -134,7 +136,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -134,7 +137,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
public double H;
|
public double H;
|
||||||
public double I;
|
public double I;
|
||||||
public double J;
|
public double J;
|
||||||
@@ -191,16 +193,19 @@ index 352b6dfb3e..a0e66b7d09 100644
|
|||||||
public boolean noclip;
|
public boolean noclip;
|
||||||
public float M;
|
public float M;
|
||||||
protected final Random random;
|
protected final Random random;
|
||||||
@@ -2072,6 +2074,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -2070,8 +2073,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
|
return false;
|
||||||
|
}
|
||||||
// Spigot end
|
// Spigot end
|
||||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
- if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
||||||
|
+ if (!this.world.isClientSide && isRidable && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) { // Purpur
|
||||||
this.passengers.add(0, entity);
|
this.passengers.add(0, entity);
|
||||||
+ this.rider = (EntityHuman) entity; // Purpur
|
+ this.rider = (EntityHuman) entity; // Purpur
|
||||||
+ onMount(rider);
|
+ onMount(rider); // Purpur
|
||||||
} else {
|
} else {
|
||||||
this.passengers.add(entity);
|
this.passengers.add(entity);
|
||||||
}
|
}
|
||||||
@@ -2110,6 +2114,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -2110,6 +2115,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Spigot end
|
// Spigot end
|
||||||
@@ -213,7 +218,7 @@ index 352b6dfb3e..a0e66b7d09 100644
|
|||||||
this.passengers.remove(entity);
|
this.passengers.remove(entity);
|
||||||
entity.j = 60;
|
entity.j = 60;
|
||||||
}
|
}
|
||||||
@@ -3221,4 +3231,20 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
@@ -3221,4 +3232,20 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||||
public void setMot(double d0, double d1, double d2) {
|
public void setMot(double d0, double d1, double d2) {
|
||||||
this.setMot(new Vec3D(d0, d1, d2));
|
this.setMot(new Vec3D(d0, d1, d2));
|
||||||
}
|
}
|
||||||
@@ -1555,7 +1560,7 @@ index f8627f818a..a27b14119e 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
index 48ce154848..68ba9b8808 100644
|
index 48ce154848..35bed55984 100644
|
||||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
@@ -9,6 +9,7 @@ import java.util.UUID;
|
@@ -9,6 +9,7 @@ import java.util.UUID;
|
||||||
@@ -1566,15 +1571,7 @@ index 48ce154848..68ba9b8808 100644
|
|||||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||||
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@@ -27,6 +28,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
@@ -63,8 +64,11 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
protected int f;
|
|
||||||
protected ControllerLook lookController;
|
|
||||||
protected ControllerMove moveController;
|
|
||||||
+ public boolean isRidable = false;// Purpur
|
|
||||||
protected ControllerJump bt;
|
|
||||||
private final EntityAIBodyControl c;
|
|
||||||
protected NavigationAbstract navigation;
|
|
||||||
@@ -63,8 +65,11 @@ public abstract class EntityInsentient extends EntityLiving {
|
|
||||||
this.bL = -1.0F;
|
this.bL = -1.0F;
|
||||||
this.goalSelector = new PathfinderGoalSelector(world != null && world.getMethodProfiler() != null ? world.getMethodProfiler() : null);
|
this.goalSelector = new PathfinderGoalSelector(world != null && world.getMethodProfiler() != null ? world.getMethodProfiler() : null);
|
||||||
this.targetSelector = new PathfinderGoalSelector(world != null && world.getMethodProfiler() != null ? world.getMethodProfiler() : null);
|
this.targetSelector = new PathfinderGoalSelector(world != null && world.getMethodProfiler() != null ? world.getMethodProfiler() : null);
|
||||||
@@ -1588,7 +1585,7 @@ index 48ce154848..68ba9b8808 100644
|
|||||||
this.bt = new ControllerJump(this);
|
this.bt = new ControllerJump(this);
|
||||||
this.c = this.o();
|
this.c = this.o();
|
||||||
this.navigation = this.b(world);
|
this.navigation = this.b(world);
|
||||||
@@ -480,6 +485,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
@@ -480,6 +484,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
return super.cF();
|
return super.cF();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1596,7 +1593,7 @@ index 48ce154848..68ba9b8808 100644
|
|||||||
public void r(float f) {
|
public void r(float f) {
|
||||||
this.bd = f;
|
this.bd = f;
|
||||||
}
|
}
|
||||||
@@ -492,6 +498,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
@@ -492,6 +497,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
this.bb = f;
|
this.bb = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1604,7 +1601,7 @@ index 48ce154848..68ba9b8808 100644
|
|||||||
@Override
|
@Override
|
||||||
public void o(float f) {
|
public void o(float f) {
|
||||||
super.o(f);
|
super.o(f);
|
||||||
@@ -1057,7 +1064,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
@@ -1057,7 +1063,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
protected boolean a(EntityHuman entityhuman, EnumHand enumhand) {
|
||||||
@@ -1613,7 +1610,7 @@ index 48ce154848..68ba9b8808 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean dH() {
|
public boolean dH() {
|
||||||
@@ -1355,4 +1362,43 @@ public abstract class EntityInsentient extends EntityLiving {
|
@@ -1355,4 +1361,43 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
public boolean a(Item item) {
|
public boolean a(Item item) {
|
||||||
return this.getItemInMainHand().getItem() == item || this.getItemInOffHand().getItem() == item;
|
return this.getItemInMainHand().getItem() == item || this.getItemInOffHand().getItem() == item;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user