Paper/nms-patches/PortalTravelAgent.patch
2019-12-11 09:00:00 +11:00

68 Zeilen
3.6 KiB
Diff

--- a/net/minecraft/server/PortalTravelAgent.java
+++ b/net/minecraft/server/PortalTravelAgent.java
@@ -43,7 +43,7 @@
List<VillagePlaceRecord> list = (List) villageplace.b((villageplacetype) -> {
return villageplacetype == VillagePlaceType.u;
}, blockposition, 128, VillagePlace.Occupancy.ANY).collect(Collectors.toList());
- Optional<VillagePlaceRecord> optional = list.stream().min(Comparator.comparingDouble((villageplacerecord) -> {
+ Optional<VillagePlaceRecord> optional = list.stream().min(Comparator.<VillagePlaceRecord>comparingDouble((villageplacerecord) -> { // CraftBukkit - decompile error
return villageplacerecord.f().m(blockposition);
}).thenComparingInt((villageplacerecord) -> {
return villageplacerecord.f().getY();
@@ -56,7 +56,7 @@
ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = BlockPortal.c((GeneratorAccess) this.world, blockposition1);
return shapedetector_shapedetectorcollection.a(enumdirection, blockposition1, d1, vec3d, d0);
- }).orElse((Object) null);
+ }).orElse(null); // CraftBukkit - decompile error
}
public boolean a(Entity entity) {
@@ -197,6 +197,7 @@
l5 = -l5;
}
+ org.bukkit.craftbukkit.util.BlockStateListPopulator blockList = new org.bukkit.craftbukkit.util.BlockStateListPopulator(this.world); // CraftBukkit - Use BlockStateListPopulator
if (d0 < 0.0D) {
i1 = MathHelper.clamp(i1, 70, this.world.getHeight() - 10);
j5 = i1;
@@ -210,7 +211,7 @@
boolean flag1 = l2 < 0;
blockposition_mutableblockposition.d(j3, l3, i4);
- this.world.setTypeUpdate(blockposition_mutableblockposition, flag1 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
+ blockList.setTypeAndData(blockposition_mutableblockposition, flag1 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData(), 3); // CraftBukkit
}
}
}
@@ -220,7 +221,7 @@
for (i3 = -1; i3 < 4; ++i3) {
if (k2 == -1 || k2 == 2 || i3 == -1 || i3 == 3) {
blockposition_mutableblockposition.d(i5 + k2 * k5, j5 + i3, j2 + k2 * l5);
- this.world.setTypeAndData(blockposition_mutableblockposition, Blocks.OBSIDIAN.getBlockData(), 3);
+ blockList.setTypeAndData(blockposition_mutableblockposition, Blocks.OBSIDIAN.getBlockData(), 3); // CraftBukkit
}
}
}
@@ -230,10 +231,19 @@
for (i3 = 0; i3 < 2; ++i3) {
for (l2 = 0; l2 < 3; ++l2) {
blockposition_mutableblockposition.d(i5 + i3 * k5, j5 + l2, j2 + i3 * l5);
- this.world.setTypeAndData(blockposition_mutableblockposition, iblockdata, 18);
+ blockList.setTypeAndData(blockposition_mutableblockposition, iblockdata, 18); // CraftBukkit
}
}
+ // CraftBukkit start
+ org.bukkit.World bworld = this.world.getWorld();
+ org.bukkit.event.world.PortalCreateEvent event = new org.bukkit.event.world.PortalCreateEvent((java.util.List<org.bukkit.block.BlockState>) (java.util.List) blockList.getList(), bworld, entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.NETHER_PAIR);
+
+ this.world.getServer().getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
+ blockList.updateList();
+ }
+ // CraftBukkit end
return true;
}
}