Commits
Parker Hawke authored and md_5 committed e5d6a9bbfcb
246 246 | + if (!bl.getType().isAir()) { |
247 247 | + VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl); |
248 248 | + level.getCraftServer().getPluginManager().callEvent(event); |
249 249 | + } |
250 250 | + } |
251 251 | + // CraftBukkit end |
252 252 | + |
253 253 | if (this.onGround) { |
254 254 | block.stepOn(this.level, blockposition, iblockdata, this); |
255 255 | } |
256 - | |
256 + | |
257 + | return SoundEffects.GENERIC_SPLASH; |
258 + | } |
259 + | |
260 + | + // CraftBukkit start - Add delegate methods |
261 + | + public SoundEffect getSwimSound0() { |
262 + | + return getSwimSound(); |
263 + | + } |
264 + | + |
265 + | + public SoundEffect getSwimSplashSound0() { |
266 + | + return getSwimSplashSound(); |
267 + | + } |
268 + | + |
269 + | + public SoundEffect getSwimHighSpeedSplashSound0() { |
270 + | + return getSwimHighSpeedSplashSound(); |
271 + | + } |
272 + | + // CraftBukkit end |
273 + | + |
274 + | protected void checkInsideBlocks() { |
275 + | AxisAlignedBB axisalignedbb = this.getBoundingBox(); |
276 + | BlockPosition blockposition = new BlockPosition(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D); |
277 + | |
257 278 | this.yo = d1; |
258 279 | this.zo = d4; |
259 280 | this.setPos(d3, d1, d4); |
260 281 | + if (valid) level.getChunk((int) Math.floor(this.getX()) >> 4, (int) Math.floor(this.getZ()) >> 4); // CraftBukkit |
261 282 | } |
262 283 | |
263 284 | public void moveTo(Vec3D vec3d) { |
264 - | |
285 + | |
265 286 | return false; |
266 287 | } |
267 288 | |
268 289 | + // CraftBukkit start - collidable API |
269 290 | + public boolean canCollideWithBukkit(Entity entity) { |
270 291 | + return isPushable(); |
271 292 | + } |
272 293 | + // CraftBukkit end |
273 294 | + |
274 295 | public void awardKillScore(Entity entity, int i, DamageSource damagesource) { |
275 296 | if (entity instanceof EntityPlayer) { |
276 297 | CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource); |
277 - | |
298 + | |
278 299 | } else { |
279 300 | String s = this.getEncodeId(); |
280 301 | |
281 302 | - if (s == null) { |
282 303 | + if (!this.persist || s == null) { // CraftBukkit - persist flag |
283 304 | return false; |
284 305 | } else { |
285 306 | nbttagcompound.putString("id", s); |
286 - | |
307 + | |
287 308 | Vec3D vec3d = this.getDeltaMovement(); |
288 309 | |
289 310 | nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z)); |
290 311 | + |
291 312 | + // CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero |
292 313 | + // TODO: make sure this is the best way to address this. |
293 314 | + if (Float.isNaN(this.yRot)) { |
294 315 | + this.yRot = 0; |
295 316 | + } |
296 317 | + |
297 318 | + if (Float.isNaN(this.xRot)) { |
298 319 | + this.xRot = 0; |
299 320 | + } |
300 321 | + // CraftBukkit end |
301 322 | + |
302 323 | nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot())); |
303 324 | nbttagcompound.putFloat("FallDistance", this.fallDistance); |
304 325 | nbttagcompound.putShort("Fire", (short) this.remainingFireTicks); |
305 - | |
326 + | |
306 327 | nbttagcompound.putBoolean("Invulnerable", this.invulnerable); |
307 328 | nbttagcompound.putInt("PortalCooldown", this.portalCooldown); |
308 329 | nbttagcompound.putUUID("UUID", this.getUUID()); |
309 330 | + // CraftBukkit start |
310 331 | + // PAIL: Check above UUID reads 1.8 properly, ie: UUIDMost / UUIDLeast |
311 332 | + nbttagcompound.putLong("WorldUUIDLeast", ((WorldServer) this.level).getWorld().getUID().getLeastSignificantBits()); |
312 333 | + nbttagcompound.putLong("WorldUUIDMost", ((WorldServer) this.level).getWorld().getUID().getMostSignificantBits()); |
313 334 | + nbttagcompound.putInt("Bukkit.updateLevel", CURRENT_LEVEL); |
314 335 | + if (!this.persist) { |
315 336 | + nbttagcompound.putBoolean("Bukkit.persist", this.persist); |
318 339 | + nbttagcompound.putBoolean("Bukkit.invisible", this.persistentInvisibility); |
319 340 | + } |
320 341 | + // SPIGOT-6907: re-implement LivingEntity#setMaximumAir() |
321 342 | + if (maxAirTicks != getDefaultMaxAirSupply()) { |
322 343 | + nbttagcompound.putInt("Bukkit.MaxAirSupply", getMaxAirSupply()); |
323 344 | + } |
324 345 | + // CraftBukkit end |
325 346 | IChatBaseComponent ichatbasecomponent = this.getCustomName(); |
326 347 | |
327 348 | if (ichatbasecomponent != null) { |
328 - | |
349 + | |
329 350 | } |
330 351 | } |
331 352 | |
332 353 | + // CraftBukkit start - stores eventually existing bukkit values |
333 354 | + if (this.bukkitEntity != null) { |
334 355 | + this.bukkitEntity.storeBukkitValues(nbttagcompound); |
335 356 | + } |
336 357 | + // CraftBukkit end |
337 358 | return nbttagcompound; |
338 359 | } catch (Throwable throwable) { |
339 360 | CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); |
340 - | |
361 + | |
341 362 | } else { |
342 363 | throw new IllegalStateException("Entity has invalid position"); |
343 364 | } |
344 365 | + |
345 366 | + // CraftBukkit start |
346 367 | + this.persist = !nbttagcompound.contains("Bukkit.persist") || nbttagcompound.getBoolean("Bukkit.persist"); |
347 368 | + // SPIGOT-6907: re-implement LivingEntity#setMaximumAir() |
348 369 | + if (nbttagcompound.contains("Bukkit.MaxAirSupply")) { |
349 370 | + maxAirTicks = nbttagcompound.getInt("Bukkit.MaxAirSupply"); |
350 371 | + } |
375 396 | + if (nbttagcompound.contains("Bukkit.invisible")) { |
376 397 | + boolean bukkitInvisible = nbttagcompound.getBoolean("Bukkit.invisible"); |
377 398 | + this.setInvisible(bukkitInvisible); |
378 399 | + this.persistentInvisibility = bukkitInvisible; |
379 400 | + } |
380 401 | + // CraftBukkit end |
381 402 | + |
382 403 | } catch (Throwable throwable) { |
383 404 | CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); |
384 405 | CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded"); |
385 - | |
406 + | |
386 407 | } else if (this.level.isClientSide) { |
387 408 | return null; |
388 409 | } else { |
389 410 | + // CraftBukkit start - Capture drops for death event |
390 411 | + if (this instanceof EntityLiving && !((EntityLiving) this).forceDrops) { |
391 412 | + ((EntityLiving) this).drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); |
392 413 | + return null; |
393 414 | + } |
394 415 | + // CraftBukkit end |
395 416 | EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY() + (double) f, this.getZ(), itemstack); |
398 419 | + // CraftBukkit start |
399 420 | + EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity()); |
400 421 | + Bukkit.getPluginManager().callEvent(event); |
401 422 | + if (event.isCancelled()) { |
402 423 | + return null; |
403 424 | + } |
404 425 | + // CraftBukkit end |
405 426 | this.level.addFreshEntity(entityitem); |
406 427 | return entityitem; |
407 428 | } |
408 - | |
429 + | |
409 430 | |
410 431 | this.setPose(EntityPose.STANDING); |
411 432 | this.vehicle = entity; |
412 433 | - this.vehicle.addPassenger(this); |
413 434 | + if (!this.vehicle.addPassenger(this)) this.vehicle = null; // CraftBukkit |
414 435 | entity.getIndirectPassengersStream().filter((entity2) -> { |
415 436 | return entity2 instanceof EntityPlayer; |
416 437 | }).forEach((entity2) -> { |
417 - | |
438 + | |
418 439 | Entity entity = this.vehicle; |
419 440 | |
420 441 | this.vehicle = null; |
421 442 | - entity.removePassenger(this); |
422 443 | + if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit |
423 444 | } |
424 445 | |
425 446 | } |
426 - | |
447 + | |
427 448 | this.removeVehicle(); |
428 449 | } |
429 450 | |
430 451 | - protected void addPassenger(Entity entity) { |
431 452 | + protected boolean addPassenger(Entity entity) { // CraftBukkit |
432 453 | if (entity.getVehicle() != this) { |
433 454 | throw new IllegalStateException("Use x.startRiding(y), not y.addPassenger(x)"); |
434 455 | } else { |
435 456 | + // CraftBukkit start |
436 457 | + com.google.common.base.Preconditions.checkState(!entity.passengers.contains(this), "Circular entity riding! %s %s", this, entity); |
449 470 | + CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle(); |
450 471 | + Entity n = craftn == null ? null : craftn.getHandle(); |
451 472 | + if (event.isCancelled() || n != orig) { |
452 473 | + return false; |
453 474 | + } |
454 475 | + } |
455 476 | + // CraftBukkit end |
456 477 | if (this.passengers.isEmpty()) { |
457 478 | this.passengers = ImmutableList.of(entity); |
458 479 | } else { |
459 - | |
480 + | |
460 481 | } |
461 482 | |
462 483 | } |
463 484 | + return true; // CraftBukkit |
464 485 | } |
465 486 | |
466 487 | - protected void removePassenger(Entity entity) { |
467 488 | + protected boolean removePassenger(Entity entity) { // CraftBukkit |
468 489 | if (entity.getVehicle() == this) { |
469 490 | throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); |
483 504 | + CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle(); |
484 505 | + Entity n = craftn == null ? null : craftn.getHandle(); |
485 506 | + if (event.isCancelled() || n != orig) { |
486 507 | + return false; |
487 508 | + } |
488 509 | + } |
489 510 | + // CraftBukkit end |
490 511 | if (this.passengers.size() == 1 && this.passengers.get(0) == entity) { |
491 512 | this.passengers = ImmutableList.of(); |
492 513 | } else { |
493 - | |
514 + | |
494 515 | |
495 516 | entity.boardingCooldown = 60; |
496 517 | } |
497 518 | + return true; // CraftBukkit |
498 519 | } |
499 520 | |
500 521 | protected boolean canAddPassenger(Entity entity) { |
501 - | |
522 + | |
502 523 | |
503 524 | if (this.isInsidePortal) { |
504 525 | MinecraftServer minecraftserver = worldserver.getServer(); |
505 526 | - ResourceKey<World> resourcekey = this.level.dimension() == World.NETHER ? World.OVERWORLD : World.NETHER; |
506 527 | + ResourceKey<World> resourcekey = this.level.getTypeKey() == WorldDimension.NETHER ? World.OVERWORLD : World.NETHER; // CraftBukkit |
507 528 | WorldServer worldserver1 = minecraftserver.getLevel(resourcekey); |
508 529 | |
509 530 | - if (worldserver1 != null && minecraftserver.isNetherEnabled() && !this.isPassenger() && this.portalTime++ >= i) { |
510 531 | + if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit |
511 532 | this.level.getProfiler().push("portal"); |
515 536 | + // CraftBukkit start |
516 537 | + if (this instanceof EntityPlayer) { |
517 538 | + ((EntityPlayer) this).changeDimension(worldserver1, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); |
518 539 | + } else { |
519 540 | + this.changeDimension(worldserver1); |
520 541 | + } |
521 542 | + // CraftBukkit end |
522 543 | this.level.getProfiler().pop(); |
523 544 | } |
524 545 | |
525 - | |
546 + | |
526 547 | } |
527 548 | |
528 549 | public void setSwimming(boolean flag) { |
529 550 | + // CraftBukkit start |
530 551 | + if (valid && this.isSwimming() != flag && this instanceof EntityLiving) { |
531 552 | + if (CraftEventFactory.callToggleSwimEvent((EntityLiving) this, flag).isCancelled()) { |
532 553 | + return; |
533 554 | + } |
534 555 | + } |
535 556 | + // CraftBukkit end |
536 557 | this.setSharedFlag(4, flag); |
537 558 | } |
538 559 | |
539 - | |
560 + | |
540 561 | return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false; |
541 562 | } |
542 563 | |
543 564 | + // CraftBukkit - start |
544 565 | public void setInvisible(boolean flag) { |
545 566 | - this.setSharedFlag(5, flag); |
546 567 | + if (!this.persistentInvisibility) { // Prevent Minecraft from removing our invisibility flag |
547 568 | + this.setSharedFlag(5, flag); |
548 569 | + } |
549 570 | + // CraftBukkit - end |
550 571 | } |
551 572 | |
552 573 | public boolean getSharedFlag(int i) { |
553 - | |
574 + | |
554 575 | } |
555 576 | |
556 577 | public int getMaxAirSupply() { |
557 578 | - return 300; |
558 579 | + return maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir() |
559 580 | } |
560 581 | |
561 582 | public int getAirSupply() { |
562 - | |
583 + | |
563 584 | } |
564 585 | |
565 586 | public void setAirSupply(int i) { |
566 587 | - this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, i); |
567 588 | + // CraftBukkit start |
568 589 | + EntityAirChangeEvent event = new EntityAirChangeEvent(this.getBukkitEntity(), i); |
569 590 | + // Suppress during worldgen |
570 591 | + if (this.valid) { |
571 592 | + event.getEntity().getServer().getPluginManager().callEvent(event); |
572 593 | + } |
573 594 | + if (event.isCancelled() && this.getAirSupply() != i) { |
574 595 | + this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID); |
575 596 | + return; |
576 597 | + } |
577 598 | + this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount()); |
578 599 | + // CraftBukkit end |
579 600 | } |
580 601 | |
581 602 | public int getTicksFrozen() { |
582 - | |
603 + | |
583 604 | |
584 605 | public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) { |
585 606 | this.setRemainingFireTicks(this.remainingFireTicks + 1); |
586 607 | + // CraftBukkit start |
587 608 | + final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity(); |
588 609 | + final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity(); |
589 610 | + final PluginManager pluginManager = Bukkit.getPluginManager(); |
590 611 | + // CraftBukkit end |
591 612 | + |
592 613 | if (this.remainingFireTicks == 0) { |
593 614 | - this.setSecondsOnFire(8); |
594 615 | + // CraftBukkit start - Call a combust event when lightning strikes |
595 616 | + EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8); |
596 617 | + pluginManager.callEvent(entityCombustEvent); |
597 618 | + if (!entityCombustEvent.isCancelled()) { |
598 619 | + this.setSecondsOnFire(entityCombustEvent.getDuration(), false); |
599 620 | + } |
600 621 | + // CraftBukkit end |
601 - | + } |
602 - | + |
622 + | } |
623 + | |
624 + | - this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F); |
603 625 | + // CraftBukkit start |
604 626 | + if (thisBukkitEntity instanceof Hanging) { |
605 627 | + HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity); |
606 628 | + pluginManager.callEvent(hangingEvent); |
607 629 | + |
608 630 | + if (hangingEvent.isCancelled()) { |
609 631 | + return; |
610 632 | + } |
611 - | } |
612 - | |
613 - | - this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F); |
633 + | + } |
634 + | + |
614 635 | + if (this.fireImmune()) { |
615 636 | + return; |
616 637 | + } |
617 638 | + CraftEventFactory.entityDamage = entitylightning; |
618 639 | + if (!this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F)) { |
619 640 | + CraftEventFactory.entityDamage = null; |
620 641 | + return; |
621 642 | + } |
622 643 | + // CraftBukkit end |
623 644 | } |
624 645 | |
625 646 | public void onAboveBubbleCol(boolean flag) { |
626 - | |
647 + | |
627 648 | |
628 649 | @Nullable |
629 650 | public Entity changeDimension(WorldServer worldserver) { |
630 651 | + // CraftBukkit start |
631 652 | + return teleportTo(worldserver, null); |
632 653 | + } |
633 654 | + |
634 655 | + @Nullable |
635 656 | + public Entity teleportTo(WorldServer worldserver, Position location) { |
636 657 | + // CraftBukkit end |
657 678 | + moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot); |
658 679 | + setDeltaMovement(shapedetectorshape.speed); |
659 680 | + return this; |
660 681 | + } |
661 682 | + this.unRide(); |
662 683 | + // CraftBukkit end |
663 684 | + |
664 685 | this.level.getProfiler().popPush("reloading"); |
665 686 | Entity entity = this.getType().create(worldserver); |
666 687 | |
667 - | |
688 + | |
668 689 | entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot()); |
669 690 | entity.setDeltaMovement(shapedetectorshape.speed); |
670 691 | worldserver.addDuringTeleport(entity); |
671 692 | - if (worldserver.dimension() == World.END) { |
672 693 | - WorldServer.makeObsidianPlatform(worldserver); |
673 694 | + if (worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit |
674 695 | + WorldServer.makeObsidianPlatform(worldserver, this); // CraftBukkit |
675 - | + } |
696 + | } |
676 697 | + // CraftBukkit start - Forward the CraftEntity to the new entity |
677 698 | + this.getBukkitEntity().setHandle(entity); |
678 699 | + entity.bukkitEntity = this.getBukkitEntity(); |
679 700 | + |
680 701 | + if (this instanceof EntityInsentient) { |
681 702 | + ((EntityInsentient) this).dropLeash(true, false); // Unleash to prevent duping of leads. |
682 - | } |
703 + | + } |
683 704 | + // CraftBukkit end |
684 705 | } |
685 706 | |
686 707 | this.removeAfterChangingDimensions(); |
687 - | |
708 + | |
688 709 | |
689 710 | @Nullable |
690 711 | protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) { |
691 712 | - boolean flag = this.level.dimension() == World.END && worldserver.dimension() == World.OVERWORLD; |
692 713 | - boolean flag1 = worldserver.dimension() == World.END; |
693 714 | + // CraftBukkit start |
694 715 | + if (worldserver == null) { |
695 716 | + return null; |
696 717 | + } |
697 718 | + boolean flag = this.level.getTypeKey() == WorldDimension.END && worldserver.getTypeKey() == WorldDimension.OVERWORLD; // fromEndToOverworld |
717 738 | + final WorldServer worldserverFinal = worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle(); |
718 739 | + worldborder = worldserverFinal.getWorldBorder(); |
719 740 | + blockposition = worldborder.clampToBounds(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); |
720 741 | |
721 742 | - return (ShapeDetectorShape) this.getExitPortal(worldserver, blockposition, flag2, worldborder).map((blockutil_rectangle) -> { |
722 743 | + return (ShapeDetectorShape) this.getExitPortal(worldserver, blockposition, flag2, worldborder, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius()).map((blockutil_rectangle) -> { |
723 744 | + // CraftBukkit end |
724 745 | IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos); |
725 746 | EnumDirection.EnumAxis enumdirection_enumaxis; |
726 747 | Vec3D vec3d; |
727 - | |
748 + | |
728 749 | vec3d = new Vec3D(0.5D, 0.0D, 0.0D); |
729 750 | } |
730 751 | |
731 752 | - return BlockPortalShape.createPortalInfo(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.getDimensions(this.getPose()), this.getDeltaMovement(), this.getYRot(), this.getXRot()); |
732 753 | - }).orElse((Object) null); |
733 754 | + return BlockPortalShape.createPortalInfo(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.getDimensions(this.getPose()), this.getDeltaMovement(), this.getYRot(), this.getXRot(), event); // CraftBukkit |
734 755 | + }).orElse(null); // CraftBukkit - decompile error |
735 756 | } |
736 757 | } else { |
737 758 | BlockPosition blockposition1; |
738 - | |
759 + | |
739 760 | } else { |
740 761 | blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos()); |
741 762 | } |
742 763 | + // CraftBukkit start |
743 764 | + CraftPortalEvent event = callPortalEvent(this, worldserver, new Position(blockposition1.getX() + 0.5D, blockposition1.getY(), blockposition1.getZ() + 0.5D), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0); |
744 765 | + if (event == null) { |
745 766 | + return null; |
746 767 | + } |
747 768 | |
748 769 | - return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getDeltaMovement(), this.getYRot(), this.getXRot()); |
749 770 | + return new ShapeDetectorShape(new Vec3D(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()), this.getDeltaMovement(), this.getYRot(), this.getXRot(), ((CraftWorld) event.getTo().getWorld()).getHandle(), event); |
750 771 | + // CraftBukkit end |
751 772 | } |
752 773 | } |
753 774 | |
754 - | |
775 + | |
755 776 | return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose())); |
756 777 | } |
757 778 | |
758 779 | - protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder) { |
759 780 | - return worldserver.getPortalForcer().findPortalAround(blockposition, flag, worldborder); |
760 781 | + // CraftBukkit start |
761 782 | + protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, Position exitPosition, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) { |
762 783 | + org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity(); |
763 784 | + Location enter = bukkitEntity.getLocation(); |
764 785 | + Location exit = new Location(exitWorldServer.getWorld(), exitPosition.x(), exitPosition.y(), exitPosition.z()); |
770 791 | + } |
771 792 | + return new CraftPortalEvent(event); |
772 793 | + } |
773 794 | + |
774 795 | + protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) { |
775 796 | + return worldserver.getPortalForcer().findPortalAround(blockposition, worldborder, searchRadius); |
776 797 | + // CraftBukkit end |
777 798 | } |
778 799 | |
779 800 | public boolean canChangeDimensions() { |
780 - | |
801 + | |
781 802 | } |
782 803 | |
783 804 | public final void setBoundingBox(AxisAlignedBB axisalignedbb) { |
784 805 | - this.bb = axisalignedbb; |
785 806 | + // CraftBukkit start - block invalid bounding boxes |
786 807 | + double minX = axisalignedbb.minX, |
787 808 | + minY = axisalignedbb.minY, |
788 809 | + minZ = axisalignedbb.minZ, |
789 810 | + maxX = axisalignedbb.maxX, |
790 811 | + maxY = axisalignedbb.maxY, |
798 819 | + if (len > 64) maxY = minY + 64.0; |
799 820 | + |
800 821 | + len = axisalignedbb.maxZ - axisalignedbb.minZ; |
801 822 | + if (len < 0) maxZ = minZ; |
802 823 | + if (len > 64) maxZ = minZ + 64.0; |
803 824 | + this.bb = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ); |
804 825 | + // CraftBukkit end |
805 826 | } |
806 827 | |
807 828 | protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) { |
808 - | |
829 + | |
809 830 | vec3d = vec3d.add(vec3d1); |
810 831 | ++k1; |
811 832 | } |
812 833 | + // CraftBukkit start - store last lava contact location |
813 834 | + if (tagkey == TagsFluid.LAVA) { |
814 835 | + this.lastLavaContact = blockposition_mutableblockposition.immutable(); |
815 836 | + } |
816 837 | + // CraftBukkit end |
817 838 | } |
818 839 | } |
819 840 | } |