summaryrefslogtreecommitdiffstats
path: root/nms-patches/PortalTravelAgent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nms-patches/PortalTravelAgent.patch')
-rw-r--r--nms-patches/PortalTravelAgent.patch79
1 files changed, 34 insertions, 45 deletions
diff --git a/nms-patches/PortalTravelAgent.patch b/nms-patches/PortalTravelAgent.patch
index e33d0809..43fa3a29 100644
--- a/nms-patches/PortalTravelAgent.patch
+++ b/nms-patches/PortalTravelAgent.patch
@@ -1,5 +1,5 @@
---- ../work/decompile-8eb82bde//net/minecraft/server/PortalTravelAgent.java 2014-11-28 17:43:43.341707430 +0000
-+++ src/main/java/net/minecraft/server/PortalTravelAgent.java 2014-11-28 17:38:23.000000000 +0000
+--- /home/matt/mc-dev-private//net/minecraft/server/PortalTravelAgent.java 2015-03-04 09:48:49.303820658 +0000
++++ src/main/java/net/minecraft/server/PortalTravelAgent.java 2015-03-04 09:48:49.311820658 +0000
@@ -5,6 +5,12 @@
import java.util.List;
import java.util.Random;
@@ -13,7 +13,7 @@
public class PortalTravelAgent {
private final WorldServer a;
-@@ -27,8 +33,21 @@
+@@ -27,6 +33,19 @@
int i = MathHelper.floor(entity.locX);
int j = MathHelper.floor(entity.locY) - 1;
int k = MathHelper.floor(entity.locZ);
@@ -29,12 +29,10 @@
+ int i = MathHelper.floor(x);
+ int j = MathHelper.floor(y) - 1;
+ int k = MathHelper.floor(z);
++ // CraftBukkit end
byte b0 = 1;
byte b1 = 0;
-+ // CraftBukkit end
- for (int l = -2; l <= 2; ++l) {
- for (int i1 = -2; i1 <= 2; ++i1) {
@@ -43,16 +62,63 @@
}
}
@@ -105,7 +103,7 @@
Object object = BlockPosition.ZERO;
long k = ChunkCoordIntPair.a(i, j);
@@ -65,7 +131,7 @@
- chunkcoordinatesportal.b = this.a.getTime();
+ portaltravelagent_chunkcoordinatesportal.c = this.a.getTime();
flag1 = false;
} else {
- BlockPosition blockposition = new BlockPosition(entity);
@@ -113,8 +111,8 @@
for (int l = -128; l <= 128; ++l) {
BlockPosition blockposition1;
-@@ -95,7 +161,29 @@
- this.c.put(k, new ChunkCoordinatesPortal(this, (BlockPosition) object, this.a.getTime()));
+@@ -95,6 +161,29 @@
+ this.c.put(k, new PortalTravelAgent.ChunkCoordinatesPortal((BlockPosition) object, this.a.getTime()));
this.d.add(Long.valueOf(k));
}
+ // CraftBukkit start - Move entity teleportation logic into exit
@@ -123,7 +121,7 @@
+ return null;
+ }
+ }
-
++
+ // Entity repositioning logic split out from original b method and combined with repositioning logic for The End from original a method
+ public void adjustExit(Entity entity, Location position, Vector velocity) {
+ Location from = position.clone();
@@ -131,7 +129,7 @@
+ BlockPosition object = new BlockPosition(position.getBlockX(), position.getBlockY(), position.getBlockZ());
+ float f = position.getYaw();
+
-+ if (this.a.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) {
++ if (this.a.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END || entity.getBukkitEntity().getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) {
+ // entity.setPositionRotation((double) i, (double) j, (double) k, entity.yaw, 0.0F);
+ // entity.motX = entity.motY = entity.motZ = 0.0D;
+ position.setPitch(0.0F);
@@ -140,37 +138,32 @@
+ velocity.setZ(0);
+ } else {
+ // CraftBukkit end
+
double d2 = (double) ((BlockPosition) object).getX() + 0.5D;
double d3 = (double) ((BlockPosition) object).getY() + 0.5D;
- double d4 = (double) ((BlockPosition) object).getZ() + 0.5D;
-@@ -170,21 +258,46 @@
- f6 = 1.0F;
- }
-
-- double d5 = entity.motX;
-- double d6 = entity.motZ;
--
-- entity.motX = d5 * (double) f3 + d6 * (double) f6;
-- entity.motZ = d5 * (double) f5 + d6 * (double) f4;
-- entity.yaw = f - (float) (enumdirection1.b() * 90) + (float) (enumdirection.b() * 90);
-+ // CraftBukkit start
-+ double d5 = velocity.getX();
-+ double d6 = velocity.getZ();
-+ // CraftBukkit end
-+
-+ // CraftBukkit start - Adjust position and velocity instances instead of entity
-+ velocity.setX(d5 * (double) f3 + d6 * (double) f6);
-+ velocity.setZ(d5 * (double) f5 + d6 * (double) f4);
-+ f = f - (float) (enumdirection1.b() * 90) + (float) (enumdirection.b() * 90);
- } else {
-- entity.motX = entity.motY = entity.motZ = 0.0D;
-+ velocity.setX(0);
-+ velocity.setY(0);
-+ velocity.setZ(0);
+@@ -134,26 +223,60 @@
+ f3 = -1.0F;
+ f4 = 1.0F;
}
-
+-
+- double d6 = entity.motX;
+- double d7 = entity.motZ;
+-
+- entity.motX = d6 * (double) f1 + d7 * (double) f4;
+- entity.motZ = d6 * (double) f3 + d7 * (double) f2;
+- entity.yaw = f - (float) (entity.aH().opposite().b() * 90) + (float) (shapedetector_shapedetectorcollection.b().b() * 90);
- entity.setPositionRotation(d2, d3, d4, entity.yaw, entity.pitch);
- return true;
++
++ // CraftBukkit start
++ double d6 = velocity.getX();
++ double d7 = velocity.getZ();
++ // CraftBukkit end
++
++ // CraftBukkit start - Adjust position and velocity instances instead of entity
++ velocity.setX(d6 * (double) f1 + d7 * (double) f4);
++ velocity.setZ(d6 * (double) f3 + d7 * (double) f2);
++ f = f - (float) (entity.aH().opposite().b() * 90) + (float) (shapedetector_shapedetectorcollection.b().b() * 90);
+ // entity.setPositionRotation(d2, d3, d4, entity.yaw, entity.pitch);
+ position.setX(d2);
+ position.setY(d3);
@@ -199,10 +192,6 @@
+ // CraftBukkit end
}
- private boolean a(BlockPosition blockposition) {
-@@ -192,11 +305,22 @@
- }
-
public boolean a(Entity entity) {
- byte b0 = 16;
+ // CraftBukkit start - Allow for portal creation to be based on coordinates instead of entity
@@ -227,7 +216,7 @@
int l = i;
int i1 = j;
int j1 = k;
-@@ -220,10 +344,10 @@
+@@ -178,10 +301,10 @@
double d4;
for (i2 = i - b0; i2 <= i + b0; ++i2) {
@@ -240,7 +229,7 @@
label271:
for (k2 = this.a.V() - 1; k2 >= 0; --k2) {
-@@ -254,7 +378,7 @@
+@@ -213,7 +336,7 @@
}
}
@@ -249,7 +238,7 @@
d4 = d1 * d1 + d3 * d3 + d2 * d2;
if (d0 < 0.0D || d4 < d0) {
d0 = d4;
-@@ -271,10 +395,10 @@
+@@ -230,10 +353,10 @@
if (d0 < 0.0D) {
for (i2 = i - b0; i2 <= i + b0; ++i2) {
@@ -262,7 +251,7 @@
label219:
for (k2 = this.a.V() - 1; k2 >= 0; --k2) {
-@@ -298,7 +422,7 @@
+@@ -258,7 +381,7 @@
}
}