mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2025-04-02 01:46:08 +02:00
Use proper radius when we're creating portal and when we're searching for one
This commit is contained in:
parent
e9ca6e37c8
commit
05c29a3951
@ -2627,7 +2627,7 @@ index 7c9d7ae5f875ba36b13d6b9b76581be0df903b49..00000000000000000000000000000000
|
||||
- playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
|
||||
- playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
|
||||
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
||||
index 62edfda9cc326a428cd267227054f03d94d22dce..934ac7fdfa040f1e00fb78b525b801ed525dae7e 100644
|
||||
index 62edfda9cc326a428cd267227054f03d94d22dce..b74888e554674caac8dfc3d8e00f5961e6527d8b 100644
|
||||
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
||||
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
||||
@@ -23,15 +23,21 @@ public class PortalTravelAgent {
|
||||
@ -2647,7 +2647,7 @@ index 62edfda9cc326a428cd267227054f03d94d22dce..934ac7fdfa040f1e00fb78b525b801ed
|
||||
- return this.world.getType(villageplacerecord.f()).b(BlockProperties.E);
|
||||
- }).findFirst();
|
||||
+ });
|
||||
+ List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY);
|
||||
+ java.util.List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY).collect(java.util.stream.Collectors.toList());
|
||||
+ for (VillagePlaceRecord villagePlaceRecord : list) {
|
||||
+ if (!seen || comparator.compare(villagePlaceRecord, best) < 0) {
|
||||
+ seen = true;
|
||||
|
@ -28,21 +28,19 @@ index 965cc06a826c7d827e6b9a9e586738bfddc974d8..8d6b24c92df72921e5cc81f4892cc960
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
||||
index 934ac7fdfa040f1e00fb78b525b801ed525dae7e..7f510d56eacdb4432fb4576de3184f67e4353170 100644
|
||||
index b74888e554674caac8dfc3d8e00f5961e6527d8b..ce50beecf16687b8d9e3ec5ba7853b4fb9e5af85 100644
|
||||
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
||||
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
||||
@@ -30,13 +30,23 @@ public class PortalTravelAgent {
|
||||
}).thenComparingInt((villageplacerecord) -> {
|
||||
@@ -31,12 +31,22 @@ public class PortalTravelAgent {
|
||||
return villageplacerecord.f().getY();
|
||||
});
|
||||
- List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY);
|
||||
+ java.util.List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY).collect(java.util.stream.Collectors.toList());
|
||||
java.util.List<VillagePlaceRecord> list = villageplace.b(type -> type == VillagePlaceType.v, blockposition, i, VillagePlace.Occupancy.ANY).collect(java.util.stream.Collectors.toList());
|
||||
+ // Yatopia start - fix portal bug
|
||||
+ if (world.origamiConfig.useBlockDistanceInPortalSearchRadius) {
|
||||
+ list.removeIf(villagePlaceRecord -> {
|
||||
+ BlockPosition portalPosition = villagePlaceRecord.getPosition();
|
||||
+ return Math.abs(portalPosition.getX() - blockposition.getX()) > world.paperConfig.portalSearchRadius
|
||||
+ || Math.abs(portalPosition.getZ() - blockposition.getZ()) > world.paperConfig.portalSearchRadius;
|
||||
+ return Math.abs(portalPosition.getX() - blockposition.getX()) > i
|
||||
+ || Math.abs(portalPosition.getZ() - blockposition.getZ()) > i;
|
||||
+ });
|
||||
+ }
|
||||
+ if (!list.isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user