Commits
484 484 | Iterator iterator = this.players.iterator(); |
485 485 | |
486 486 | |
487 487 | } |
488 488 | } |
489 489 | |
490 490 | + return serverexplosion; // CraftBukkit |
491 491 | } |
492 492 | |
493 493 | private Explosion.Effect getDestroyType(GameRules.GameRuleKey<GameRules.GameRuleBoolean> gamerules_gamerulekey) { |
494 - | |
494 + | |
495 495 | } |
496 496 | |
497 497 | public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { |
498 498 | - return this.sendParticles(t0, false, false, d0, d1, d2, i, d3, d4, d5, d6); |
499 - | + // CraftBukkit - visibility api support |
500 - | + return this.sendParticlesSource(null, t0, false, false, d0, d1, d2, i, d3, d4, d5, d6); |
499 + | + return this.sendParticlesSource(null, t0, false, false, d0, d1, d2, i, d3, d4, d5, d6); // CraftBukkit - visibility api support |
501 500 | } |
502 501 | |
503 - | - public <T extends ParticleParam> int sendParticles(T t0, boolean flag, boolean flag1, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { |
502 + | public <T extends ParticleParam> int sendParticles(T t0, boolean flag, boolean flag1, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { |
503 + | + return this.sendParticlesSource(null, t0, flag, flag1, d0, d1, d2, i, d3, d4, d5, d6); // CraftBukkit - visibility api support |
504 + | + } |
505 + | + |
506 + | + // CraftBukkit start - visibility api support |
504 507 | + public <T extends ParticleParam> int sendParticlesSource(EntityPlayer sender, T t0, boolean flag, boolean flag1, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { |
505 508 | + // CraftBukkit end |
506 509 | PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(t0, flag, flag1, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i); |
507 510 | int j = 0; |
508 511 | |
509 512 | for (int k = 0; k < this.players.size(); ++k) { |
510 513 | EntityPlayer entityplayer = (EntityPlayer) this.players.get(k); |
511 514 | + if (sender != null && !entityplayer.getBukkitEntity().canSee(sender.getBukkitEntity())) continue; // CraftBukkit |
512 515 | |
513 516 | if (this.sendParticles(entityplayer, flag, d0, d1, d2, packetplayoutworldparticles)) { |
514 517 | ++j; |
515 - | |
518 + | |
516 519 | |
517 520 | @Nullable |
518 521 | public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) { |
519 522 | - if (!this.server.getWorldData().worldGenOptions().generateStructures()) { |
520 523 | + if (!this.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit |
521 524 | return null; |
522 525 | } else { |
523 526 | Optional<HolderSet.Named<Structure>> optional = this.registryAccess().lookupOrThrow(Registries.STRUCTURE).get(tagkey); |
524 - | |
527 + | |
525 528 | @Nullable |
526 529 | @Override |
527 530 | public WorldMap getMapData(MapId mapid) { |
528 531 | - return (WorldMap) this.getServer().overworld().getDataStorage().get(WorldMap.factory(), mapid.key()); |
529 532 | + // CraftBukkit start |
530 533 | + WorldMap worldmap = (WorldMap) this.getServer().overworld().getDataStorage().get(WorldMap.factory(), mapid.key()); |
531 534 | + if (worldmap != null) { |
532 535 | + worldmap.id = mapid; |
533 536 | + } |
534 537 | + return worldmap; |
538 541 | @Override |
539 542 | public void setMapData(MapId mapid, WorldMap worldmap) { |
540 543 | + // CraftBukkit start |
541 544 | + worldmap.id = mapid; |
542 545 | + MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView); |
543 546 | + Bukkit.getServer().getPluginManager().callEvent(event); |
544 547 | + // CraftBukkit end |
545 548 | this.getServer().overworld().getDataStorage().set(mapid.key(), worldmap); |
546 549 | } |
547 550 | |
548 - | |
551 + | |
549 552 | @Override |
550 553 | public void blockUpdated(BlockPosition blockposition, Block block) { |
551 554 | if (!this.isDebug()) { |
552 555 | + // CraftBukkit start |
553 556 | + if (populating) { |
554 557 | + return; |
555 558 | + } |
556 559 | + // CraftBukkit end |
557 560 | this.updateNeighborsAt(blockposition, block); |
558 561 | } |
559 562 | |
560 - | |
563 + | |
561 564 | } |
562 565 | |
563 566 | public boolean isFlat() { |
564 567 | - return this.server.getWorldData().isFlatWorld(); |
565 568 | + return this.serverLevelData.isFlatWorld(); // CraftBukkit |
566 569 | } |
567 570 | |
568 571 | @Override |
569 572 | public long getSeed() { |
570 573 | - return this.server.getWorldData().worldGenOptions().seed(); |
571 574 | + return this.serverLevelData.worldGenOptions().seed(); // CraftBukkit |
572 575 | } |
573 576 | |
574 577 | @Nullable |
575 - | |
578 + | |
576 579 | private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) { |
577 580 | try { |
578 581 | Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap(); |
579 582 | - Iterator iterator = iterable.iterator(); |
580 583 | + Iterator<T> iterator = iterable.iterator(); // CraftBukkit - decompile error |
581 584 | |
582 585 | while (iterator.hasNext()) { |
583 586 | T t0 = iterator.next(); |
584 - | |
587 + | |
585 588 | object2intopenhashmap.addTo(s, 1); |
586 589 | } |
587 590 | |
588 591 | - return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Entry::getIntValue).reversed()).limit(5L).map((entry) -> { |
589 592 | + return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Entry<String>::getIntValue).reversed()).limit(5L).map((entry) -> { // CraftBukkit - decompile error |
590 593 | String s1 = (String) entry.getKey(); |
591 594 | |
592 595 | return s1 + ":" + entry.getIntValue(); |
593 - | |
596 + | |
594 597 | } |
595 598 | |
596 599 | entity.updateDynamicGameEventListener(DynamicGameEventListener::add); |
597 600 | + entity.inWorld = true; // CraftBukkit - Mark entity as in world |
598 601 | + entity.valid = true; // CraftBukkit |
599 602 | } |
600 603 | |
601 604 | public void onTrackingEnd(Entity entity) { |
602 - | |
605 + | |
603 606 | } |
604 607 | |
605 608 | entity.updateDynamicGameEventListener(DynamicGameEventListener::remove); |
606 609 | + // CraftBukkit start |
607 610 | + entity.valid = false; |
608 611 | + if (!(entity instanceof EntityPlayer)) { |
609 612 | + for (EntityPlayer player : players) { |
610 613 | + player.getBukkitEntity().onEntityRemove(entity); |
611 614 | + } |
612 615 | + } |