Skip to content

Commit

Permalink
Fix riding non-ridables stopping mob AI
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyGalbreath committed Jun 24, 2019
1 parent 17c6227 commit f4931c9
Showing 1 changed file with 23 additions and 26 deletions.
49 changes: 23 additions & 26 deletions patches/server/0011-Integrate-ridables.patch
@@ -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>
Date: Tue, 30 Apr 2019 19:17:21 -0500
Subject: [PATCH] Integrate ridables

---
.../server/ControllerLookDolphin.java | 4 +-
.../java/net/minecraft/server/Entity.java | 28 ++++-
.../java/net/minecraft/server/Entity.java | 31 ++++-
.../net/minecraft/server/EntityAgeable.java | 2 +-
.../java/net/minecraft/server/EntityBat.java | 22 ++++
.../net/minecraft/server/EntityBlaze.java | 15 ++-
Expand All @@ -31,7 +31,7 @@ Subject: [PATCH] Integrate ridables
.../net/minecraft/server/EntityHuman.java | 14 ++-
.../server/EntityIllagerIllusioner.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/EntityLiving.java | 25 +++-
.../net/minecraft/server/EntityMagmaCube.java | 3 +-
Expand Down Expand Up @@ -134,7 +134,7 @@ Subject: [PATCH] Integrate ridables
.../controller/ControllerMoveWASDWater.java | 42 +++++++
.../craftbukkit/entity/CraftLivingEntity.java | 10 ++
.../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/ControllerMoveWASD.java
create mode 100644 src/main/java/net/pl3x/purpur/controller/ControllerMoveWASDFlying.java
Expand Down Expand Up @@ -163,7 +163,7 @@ index 454627f65e..df3d6cf281 100644
this.d = false;
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
index 352b6dfb3e..a0e66b7d09 100644
index 352b6dfb3e..f78d721941 100644
--- a/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
Expand All @@ -174,15 +174,17 @@ index 352b6dfb3e..a0e66b7d09 100644
Throwable addedToWorldStack; // Paper - entity debug
public CraftEntity getBukkitEntity() {
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;
public boolean i; public final boolean blocksEntitySpawning() { return this.i; } // Paper - OBFHELPER
+ public boolean isRidable = false;// Purpur
public final List<Entity> passengers;
+ private EntityHuman rider; public EntityHuman getRider() { return rider; } // Purpur
protected int j;
private Entity vehicle;
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 I;
public double J;
Expand All @@ -191,16 +193,19 @@ index 352b6dfb3e..a0e66b7d09 100644
public boolean noclip;
public float M;
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
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.rider = (EntityHuman) entity; // Purpur
+ onMount(rider);
+ onMount(rider); // Purpur
} else {
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;
}
// Spigot end
Expand All @@ -213,7 +218,7 @@ index 352b6dfb3e..a0e66b7d09 100644
this.passengers.remove(entity);
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) {
this.setMot(new Vec3D(d0, d1, d2));
}
Expand Down Expand Up @@ -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
index 48ce154848..68ba9b8808 100644
index 48ce154848..35bed55984 100644
--- a/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;
Expand All @@ -1566,15 +1571,7 @@ index 48ce154848..68ba9b8808 100644
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.entity.LivingEntity;
@@ -27,6 +28,7 @@ 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 {
@@ -63,8 +64,11 @@ public abstract class EntityInsentient extends EntityLiving {
this.bL = -1.0F;
this.goalSelector = new PathfinderGoalSelector(world != null && world.getMethodProfiler() != null ? world.getMethodProfiler() : null);
this.targetSelector = new PathfinderGoalSelector(world != null && world.getMethodProfiler() != null ? world.getMethodProfiler() : null);
Expand All @@ -1588,23 +1585,23 @@ index 48ce154848..68ba9b8808 100644
this.bt = new ControllerJump(this);
this.c = this.o();
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();
}

+ public void setForwardSpeed(float speed) { this.r(speed); } // Purpur - OBFHELPER
public void r(float 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;
}

+ public void setSpeed(float speed) { o(speed); } // Purpur - OBFHELPER
@Override
public void o(float 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) {
Expand All @@ -1613,7 +1610,7 @@ index 48ce154848..68ba9b8808 100644
}

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) {
return this.getItemInMainHand().getItem() == item || this.getItemInOffHand().getItem() == item;
}
Expand Down

0 comments on commit f4931c9

Please sign in to comment.