Skip to content
Permalink
Browse files

Added finite checks. Appears to be a bug in Spigot for 1.13 where ent…

…ities have infinite velocity.
  • Loading branch information...
me4502 committed Nov 18, 2018
1 parent 99b3350 commit 2b5201d7d7ce4c1677b23af2fdc4a5a5cd54abbe
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/main/java/com/sk89q/craftbook/mechanics/minecart/RemoveEntities.java
@@ -33,7 +33,10 @@ public void onVehicleEntityCollision(VehicleEntityCollisionEvent event) {
if(event.getEntity().isInsideVehicle())
return;
((LivingEntity) event.getEntity()).damage(10);
event.getEntity().setVelocity(event.getVehicle().getVelocity().normalize().multiply(1.8).add(new Vector(0,0.5,0)));
Vector newVelocity = event.getVehicle().getVelocity().normalize().multiply(1.8).add(new Vector(0,0.5,0));
if (Double.isFinite(newVelocity.getX()) && Double.isFinite(newVelocity.getY()) && Double.isFinite(newVelocity.getZ())) {
event.getEntity().setVelocity(newVelocity);
}
} else if (event.getEntity() instanceof Vehicle) {

if(!event.getEntity().isEmpty())

0 comments on commit 2b5201d

Please sign in to comment.
You can’t perform that action at this time.