|
413 | 413 | } |
414 | 414 |
|
415 | 415 | // Paper start - optimise random ticking |
416 | | -@@ -1199,7 +_,7 @@ |
| 416 | +@@ -1198,7 +_,7 @@ |
417 | 417 | } |
418 | 418 |
|
419 | 419 | public boolean isHandlingTick() { |
|
422 | 422 | } |
423 | 423 |
|
424 | 424 | public boolean canSleepThroughNights() { |
425 | | -@@ -1420,27 +_,29 @@ |
| 425 | +@@ -1419,27 +_,29 @@ |
426 | 426 | this.emptyTime = 0; |
427 | 427 | } |
428 | 428 |
|
|
456 | 456 | ((ca.spottedleaf.moonrise.patches.chunk_system.server.ChunkSystemMinecraftServer)this.server).moonrise$executeMidTickTasks(); |
457 | 457 | } |
458 | 458 | // Paper end - rewrite chunk system |
459 | | -@@ -1495,7 +_,7 @@ |
| 459 | +@@ -1494,7 +_,7 @@ |
460 | 460 | private void tickPassenger(final Entity vehicle, final Entity entity, final boolean isActive) { // Paper - EAR 2 |
461 | 461 | if (entity.isRemoved() || entity.getVehicle() != vehicle) { |
462 | 462 | entity.stopRiding(); |
|
465 | 465 | entity.setOldPosAndRot(); |
466 | 466 | entity.tickCount++; |
467 | 467 | entity.totalEntityAge++; // Paper - age-like counter for all entities |
468 | | -@@ -1719,8 +_,8 @@ |
| 468 | +@@ -1718,8 +_,8 @@ |
469 | 469 | } else { |
470 | 470 | if (entity instanceof net.minecraft.world.entity.item.ItemEntity item && item.getItem().isEmpty()) return false; // Paper - Prevent empty items from being added |
471 | 471 | // Paper start - capture all item additions to the world |
|
476 | 476 | return true; |
477 | 477 | } |
478 | 478 | // Paper end - capture all item additions to the world |
479 | | -@@ -1806,7 +_,9 @@ |
| 479 | +@@ -1805,7 +_,9 @@ |
480 | 480 | .callEvent(); |
481 | 481 | } |
482 | 482 | // Paper end - Add BlockBreakProgressUpdateEvent |
|
487 | 487 | if (player.level() == this && player.getId() != id) { |
488 | 488 | double xd = blockPos.getX() - player.getX(); |
489 | 489 | double yd = blockPos.getY() - player.getY(); |
490 | | -@@ -1817,7 +_,7 @@ |
| 490 | +@@ -1816,7 +_,7 @@ |
491 | 491 | continue; |
492 | 492 | } |
493 | 493 | // CraftBukkit end |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | } |
499 | | -@@ -1926,7 +_,7 @@ |
| 499 | +@@ -1925,7 +_,7 @@ |
500 | 500 |
|
501 | 501 | @Override |
502 | 502 | public void sendBlockUpdated(final BlockPos pos, final BlockState old, final BlockState current, final @Block.UpdateFlags int updateFlags) { |
|
505 | 505 | String message = "recursive call to sendBlockUpdated"; |
506 | 506 | Util.logAndPauseIfInIde("recursive call to sendBlockUpdated", new IllegalStateException("recursive call to sendBlockUpdated")); |
507 | 507 | } |
508 | | -@@ -1940,7 +_,7 @@ |
| 508 | +@@ -1939,7 +_,7 @@ |
509 | 509 | List<PathNavigation> navigationsToUpdate = new ObjectArrayList<>(); |
510 | 510 |
|
511 | 511 | try { // Paper - catch CME see below why |
|
514 | 514 | PathNavigation pathNavigation = navigatingMob.getNavigation(); |
515 | 515 | if (pathNavigation.shouldRecomputePath(pos)) { |
516 | 516 | navigationsToUpdate.add(pathNavigation); |
517 | | -@@ -1957,13 +_,13 @@ |
| 517 | +@@ -1956,13 +_,13 @@ |
518 | 518 | // Paper end - catch CME see below why |
519 | 519 |
|
520 | 520 | try { |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | } // Paper - option to disable pathfinding updates |
533 | | -@@ -1972,17 +_,17 @@ |
| 533 | +@@ -1971,17 +_,17 @@ |
534 | 534 | @Override |
535 | 535 | public void updateNeighborsAt(final BlockPos pos, final Block sourceBlock) { |
536 | 536 | // CraftBukkit start |
|
551 | 551 | this.neighborUpdater.updateNeighborsAtExceptFromFacing(pos, sourceBlock, null, orientation); |
552 | 552 | } |
553 | 553 |
|
554 | | -@@ -2111,14 +_,15 @@ |
| 554 | +@@ -2110,14 +_,15 @@ |
555 | 555 |
|
556 | 556 | @Override |
557 | 557 | public void blockEvent(final BlockPos pos, final Block block, final int b0, final int b1) { |
|
572 | 572 | if (this.shouldTickBlocksAt(eventData.pos())) { |
573 | 573 | if (this.doBlockEvent(eventData)) { |
574 | 574 | this.server |
575 | | -@@ -2134,11 +_,11 @@ |
| 575 | +@@ -2133,11 +_,11 @@ |
576 | 576 | ); |
577 | 577 | } |
578 | 578 | } else { |
|
586 | 586 | } |
587 | 587 |
|
588 | 588 | private boolean doBlockEvent(final BlockEventData eventData) { |
589 | | -@@ -2388,7 +_,7 @@ |
| 589 | +@@ -2387,7 +_,7 @@ |
590 | 590 | final MapItemSavedData mapData = storage.get(MapItemSavedData.type(id)); // get populates the cache |
591 | 591 | if (mapData != null) { // map was read, init it and return |
592 | 592 | mapData.id = id; |
|
595 | 595 | return mapData; |
596 | 596 | } |
597 | 597 |
|
598 | | -@@ -2407,8 +_,7 @@ |
| 598 | +@@ -2406,8 +_,7 @@ |
599 | 599 | public void setMapData(final MapId id, final MapItemSavedData data) { |
600 | 600 | // CraftBukkit start |
601 | 601 | data.id = id; |
|
605 | 605 | // CraftBukkit end |
606 | 606 | this.getServer().getDataStorage().set(MapItemSavedData.type(id), data); |
607 | 607 | } |
608 | | -@@ -2464,11 +_,11 @@ |
| 608 | +@@ -2463,11 +_,11 @@ |
609 | 609 | Optional<Holder<PoiType>> newType = PoiTypes.forState(newState); |
610 | 610 | if (!Objects.equals(oldType, newType)) { |
611 | 611 | BlockPos immutable = pos.immutable(); |
|
619 | 619 | // Paper start - Remove stale POIs |
620 | 620 | if (oldType.isEmpty() && this.getPoiManager().exists(immutable, _ -> true)) { |
621 | 621 | this.getPoiManager().remove(immutable); |
622 | | -@@ -2531,7 +_,7 @@ |
| 622 | +@@ -2530,7 +_,7 @@ |
623 | 623 | } |
624 | 624 |
|
625 | 625 | output.write(String.format(Locale.ROOT, "entities: %s\n", this.moonrise$getEntityLookup().getDebugInfo())); // Paper - rewrite chunk system |
|
628 | 628 | output.write(String.format(Locale.ROOT, "block_ticks: %d\n", this.getBlockTicks().count())); |
629 | 629 | output.write(String.format(Locale.ROOT, "fluid_ticks: %d\n", this.getFluidTicks().count())); |
630 | 630 | output.write("distance_manager: " + chunkMap.getDistanceManager().getDebugStatus() + "\n"); |
631 | | -@@ -2599,17 +_,25 @@ |
| 631 | +@@ -2598,17 +_,25 @@ |
632 | 632 | } |
633 | 633 |
|
634 | 634 | private void dumpBlockEntityTickers(final Writer output) throws IOException { |
|
661 | 661 | } |
662 | 662 |
|
663 | 663 | public Iterable<Entity> getAllEntities() { |
664 | | -@@ -2651,8 +_,8 @@ |
| 664 | +@@ -2650,8 +_,8 @@ |
665 | 665 | this.players.size(), |
666 | 666 | this.moonrise$getEntityLookup().getDebugInfo(), // Paper - rewrite chunk system |
667 | 667 | getTypeCount(this.moonrise$getEntityLookup().getAll(), e -> e.typeHolder().getRegisteredName()), // Paper - rewrite chunk system |
|
672 | 672 | this.getBlockTicks().count(), |
673 | 673 | this.getFluidTicks().count(), |
674 | 674 | this.gatherChunkSourceStats() |
675 | | -@@ -2682,7 +_,7 @@ |
| 675 | +@@ -2681,7 +_,7 @@ |
676 | 676 |
|
677 | 677 | @Override |
678 | 678 | public LevelEntityGetter<Entity> getEntities() { |
|
681 | 681 | return this.moonrise$getEntityLookup(); // Paper - rewrite chunk system |
682 | 682 | } |
683 | 683 |
|
684 | | -@@ -2870,7 +_,7 @@ |
| 684 | +@@ -2869,7 +_,7 @@ |
685 | 685 | // Paper start - optimize redstone (Alternate Current) |
686 | 686 | @Override |
687 | 687 | public alternate.current.wire.WireHandler getWireHandler() { |
|
690 | 690 | } |
691 | 691 | // Paper end - optimize redstone (Alternate Current) |
692 | 692 |
|
693 | | -@@ -2911,12 +_,12 @@ |
| 693 | +@@ -2910,12 +_,12 @@ |
694 | 694 | @Override |
695 | 695 | public void onTickingStart(final Entity entity) { |
696 | 696 | if (entity instanceof net.minecraft.world.entity.Marker && !paperConfig().entities.markers.tick) return; // Paper - Configurable marker ticking |
|
705 | 705 | // Paper start - Reset pearls when they stop being ticked |
706 | 706 | if (ServerLevel.this.paperConfig().fixes.disableUnloadedChunkEnderpearlExploit && ServerLevel.this.paperConfig().misc.legacyEnderPearlBehavior && entity instanceof net.minecraft.world.entity.projectile.throwableitemprojectile.ThrownEnderpearl pearl) { |
707 | 707 | pearl.setOwner(null); |
708 | | -@@ -2926,10 +_,11 @@ |
| 708 | +@@ -2925,10 +_,11 @@ |
709 | 709 |
|
710 | 710 | @Override |
711 | 711 | public void onTrackingStart(final Entity entity) { |
|
718 | 718 | if (player.isReceivingWaypoints()) { |
719 | 719 | ServerLevel.this.getWaypointManager().addPlayer(player); |
720 | 720 | } |
721 | | -@@ -2942,14 +_,14 @@ |
| 721 | +@@ -2941,14 +_,14 @@ |
722 | 722 | } |
723 | 723 |
|
724 | 724 | if (entity instanceof Mob mob) { |
|
735 | 735 | } |
736 | 736 |
|
737 | 737 | if (entity instanceof EnderDragon dragon) { |
738 | | -@@ -2976,7 +_,7 @@ |
| 738 | +@@ -2975,7 +_,7 @@ |
739 | 739 |
|
740 | 740 | @Override |
741 | 741 | public void onTrackingEnd(final Entity entity) { |
|
744 | 744 | // Spigot start // TODO I don't think this is needed anymore |
745 | 745 | if (entity instanceof Player player) { |
746 | 746 | for (final ServerLevel level : ServerLevel.this.getServer().getAllLevels()) { |
747 | | -@@ -2985,10 +_,12 @@ |
| 747 | +@@ -2984,10 +_,12 @@ |
748 | 748 | continue; |
749 | 749 | } |
750 | 750 |
|
|
757 | 757 | } |
758 | 758 | } |
759 | 759 | } |
760 | | -@@ -3007,20 +_,21 @@ |
| 760 | +@@ -3006,20 +_,21 @@ |
761 | 761 | // Spigot end |
762 | 762 | ServerLevel.this.getChunkSource().removeEntity(entity); |
763 | 763 | if (entity instanceof ServerPlayer player) { |
|
781 | 781 | } |
782 | 782 |
|
783 | 783 | if (entity instanceof EnderDragon dragon) { |
784 | | -@@ -3045,6 +_,9 @@ |
| 784 | +@@ -3044,6 +_,9 @@ |
785 | 785 | @Override |
786 | 786 | public void onSectionChange(final Entity entity) { |
787 | 787 | entity.updateDynamicGameEventListener(DynamicGameEventListener::move); |
|
0 commit comments