Should fix IndexOutOfBoundsException when copying

fixes#2290
This commit is contained in:
dordsor21 2019-03-08 23:04:38 +00:00
parent 4c8457ad14
commit ed10877431

View File

@ -10,6 +10,8 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle; import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.List;
public final class ReplicatingEntityWrapper extends EntityWrapper { public final class ReplicatingEntityWrapper extends EntityWrapper {
private final short depth; private final short depth;
@ -38,9 +40,9 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
if (depth == 0) { if (depth == 0) {
return; return;
} }
Entity passenger = entity.getPassengers().get(0); List<Entity> passengers = entity.getPassengers();
if (passenger != null) { if (passengers.size() > 0) {
this.base.passenger = new ReplicatingEntityWrapper(passenger, depth); this.base.passenger = new ReplicatingEntityWrapper(passengers.get(0), depth);
} }
this.base.fall = entity.getFallDistance(); this.base.fall = entity.getFallDistance();
this.base.fire = (short) entity.getFireTicks(); this.base.fire = (short) entity.getFireTicks();