SPIGOT-5514: VehicleEntityCollisionEvent triggered by passengers
By: Lars Dormans <lars.dormans@live.nl>
This commit is contained in:
@@ -122,7 +122,7 @@
|
||||
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && b(this.getMot()) > 0.01D) {
|
||||
List<Entity> list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.a(this));
|
||||
|
||||
@@ -235,8 +297,24 @@
|
||||
@@ -235,8 +297,26 @@
|
||||
Entity entity = (Entity) list.get(l);
|
||||
|
||||
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
|
||||
@@ -137,17 +137,19 @@
|
||||
entity.startRiding(this);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(collisionEvent);
|
||||
+ if (!this.isSameVehicle(entity)) {
|
||||
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, entity.getBukkitEntity());
|
||||
+ this.world.getServer().getPluginManager().callEvent(collisionEvent);
|
||||
+
|
||||
+ if (collisionEvent.isCancelled()) {
|
||||
+ continue;
|
||||
+ if (collisionEvent.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity.collide(this);
|
||||
}
|
||||
}
|
||||
@@ -248,6 +326,14 @@
|
||||
@@ -248,6 +328,14 @@
|
||||
Entity entity1 = (Entity) iterator.next();
|
||||
|
||||
if (!this.w(entity1) && entity1.isCollidable() && entity1 instanceof EntityMinecartAbstract) {
|
||||
@@ -162,7 +164,7 @@
|
||||
entity1.collide(this);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +344,7 @@
|
||||
@@ -258,7 +346,7 @@
|
||||
}
|
||||
|
||||
protected double getMaxSpeed() {
|
||||
@@ -171,7 +173,7 @@
|
||||
}
|
||||
|
||||
public void a(int i, int j, int k, boolean flag) {}
|
||||
@@ -269,12 +355,16 @@
|
||||
@@ -269,12 +357,16 @@
|
||||
|
||||
this.setMot(MathHelper.a(vec3d.x, -d0, d0), vec3d.y, MathHelper.a(vec3d.z, -d0, d0));
|
||||
if (this.onGround) {
|
||||
@@ -190,7 +192,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -461,7 +551,7 @@
|
||||
@@ -461,7 +553,7 @@
|
||||
}
|
||||
|
||||
protected void decelerate() {
|
||||
@@ -199,7 +201,7 @@
|
||||
|
||||
this.setMot(this.getMot().d(d0, 0.0D, d0));
|
||||
}
|
||||
@@ -544,6 +634,14 @@
|
||||
@@ -544,6 +636,14 @@
|
||||
if (!this.world.isClientSide) {
|
||||
if (!entity.noclip && !this.noclip) {
|
||||
if (!this.w(entity)) {
|
||||
@@ -214,7 +216,7 @@
|
||||
double d0 = entity.locX() - this.locX();
|
||||
double d1 = entity.locZ() - this.locZ();
|
||||
double d2 = d0 * d0 + d1 * d1;
|
||||
@@ -679,4 +777,26 @@
|
||||
@@ -679,4 +779,26 @@
|
||||
|
||||
private EnumMinecartType() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user