diff options
author | md_5 <git@md-5.net> | 2016-03-01 08:32:46 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2016-03-01 09:32:45 +1100 |
commit | aa008dff0f9bedbe88e1fe79831776b0a52eb90a (patch) | |
tree | cb520e0f4cc5d683fb9b7fb95de37480a7443dfb /nms-patches/PortalTravelAgent.patch | |
parent | e1ebe524a78e27f6a2829ed4574fded3779094e1 (diff) | |
download | craftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.tar craftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.tar.gz craftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.tar.lz craftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.tar.xz craftbukkit-aa008dff0f9bedbe88e1fe79831776b0a52eb90a.zip |
Update to Minecraft 1.9
Diffstat (limited to 'nms-patches/PortalTravelAgent.patch')
-rw-r--r-- | nms-patches/PortalTravelAgent.patch | 82 |
1 files changed, 47 insertions, 35 deletions
diff --git a/nms-patches/PortalTravelAgent.patch b/nms-patches/PortalTravelAgent.patch index 73698d3b..eef8a8d6 100644 --- a/nms-patches/PortalTravelAgent.patch +++ b/nms-patches/PortalTravelAgent.patch @@ -1,19 +1,17 @@ --- a/net/minecraft/server/PortalTravelAgent.java +++ b/net/minecraft/server/PortalTravelAgent.java -@@ -5,6 +5,12 @@ - import java.util.List; - import java.util.Random; +@@ -1,6 +1,10 @@ + package net.minecraft.server; -+// CraftBukkit start + import com.google.common.collect.Lists; +import org.bukkit.Location; +import org.bukkit.event.entity.EntityPortalExitEvent; +import org.bukkit.util.Vector; -+// CraftBukkit end + - public class PortalTravelAgent { - - private final WorldServer a; -@@ -27,6 +33,19 @@ + import java.util.Iterator; + import java.util.List; + import java.util.Random; +@@ -27,6 +31,19 @@ int i = MathHelper.floor(entity.locX); int j = MathHelper.floor(entity.locY) - 1; int k = MathHelper.floor(entity.locZ); @@ -33,7 +31,7 @@ byte b0 = 1; byte b1 = 0; -@@ -43,16 +62,63 @@ +@@ -43,16 +60,63 @@ } } @@ -59,7 +57,7 @@ + int i2 = k + i1 * b1 - l * b0; + boolean flag = j1 < 0; + -+ if (this.a.getType(new BlockPosition(k1, l1, i2)).getBlock() != (flag ? Blocks.OBSIDIAN : Blocks.AIR)) { ++ if (this.world.getType(new BlockPosition(k1, l1, i2)).getBlock() != (flag ? Blocks.OBSIDIAN : Blocks.AIR)) { + return null; + } + } @@ -77,7 +75,7 @@ + return false; + } + -+ Location exit = new Location(this.a.getWorld(), found.getX(), found.getY(), found.getZ(), f, entity.pitch); ++ Location exit = new Location(this.world.getWorld(), found.getX(), found.getY(), found.getZ(), f, entity.pitch); + Vector velocity = entity.getBukkitEntity().getVelocity(); + this.adjustExit(entity, exit, velocity); + entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); @@ -88,8 +86,8 @@ + } + + public BlockPosition findPortal(double x, double y, double z, int short1) { -+ if (this.a.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) { -+ return this.findEndPortal(this.a.worldProvider.h()); ++ if (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) { ++ return this.findEndPortal(this.world.worldProvider.h()); + } + // CraftBukkit end double d0 = -1.0D; @@ -102,17 +100,17 @@ boolean flag1 = true; Object object = BlockPosition.ZERO; long k = ChunkCoordIntPair.a(i, j); -@@ -65,7 +131,7 @@ - portaltravelagent_chunkcoordinatesportal.c = this.a.getTime(); +@@ -65,7 +129,7 @@ + portaltravelagent_chunkcoordinatesportal.c = this.world.getTime(); flag1 = false; } else { - BlockPosition blockposition = new BlockPosition(entity); -+ BlockPosition blockposition = new BlockPosition(x, y, z); ++ BlockPosition blockposition = new BlockPosition(x, y, z); // CraftBukkit for (int l = -128; l <= 128; ++l) { BlockPosition blockposition1; -@@ -95,6 +161,29 @@ - this.c.put(k, new PortalTravelAgent.ChunkCoordinatesPortal((BlockPosition) object, this.a.getTime())); +@@ -95,6 +159,29 @@ + this.c.put(k, new PortalTravelAgent.ChunkCoordinatesPortal((BlockPosition) object, this.world.getTime())); this.d.add(Long.valueOf(k)); } + // CraftBukkit start - Move entity teleportation logic into exit @@ -129,7 +127,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 || entity.getBukkitEntity().getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END || entity.aG() == null) { ++ if (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END || entity.getBukkitEntity().getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END || entity.getPortalOffset() == null) { + // entity.setPositionRotation((double) i, (double) j, (double) k, entity.yaw, 0.0F); + // entity.motX = entity.motY = entity.motZ = 0.0D; + position.setPitch(0.0F); @@ -141,20 +139,23 @@ double d2 = (double) ((BlockPosition) object).getX() + 0.5D; double d3 = (double) ((BlockPosition) object).getY() + 0.5D; -@@ -132,26 +221,60 @@ - f3 = -1.0F; +@@ -133,30 +220,59 @@ 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); +- entity.yaw = f - (float) (entity.getPortalDirection().opposite().get2DRotationValue() * 90) + (float) (shapedetector_shapedetectorcollection.getFacing().get2DRotationValue() * 90); +- if (entity instanceof EntityPlayer) { +- ((EntityPlayer) entity).playerConnection.a(d2, d3, d4, entity.yaw, entity.pitch); +- } else { +- entity.setPositionRotation(d2, d3, d4, entity.yaw, entity.pitch); +- } +- - return true; -+ + // CraftBukkit start + double d6 = velocity.getX(); + double d7 = velocity.getZ(); @@ -163,7 +164,7 @@ + // 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); ++ f = f - (float) (entity.getPortalDirection().opposite().get2DRotationValue() * 90) + (float) (shapedetector_shapedetectorcollection.getFacing().get2DRotationValue() * 90); + // entity.setPositionRotation(d2, d3, d4, entity.yaw, entity.pitch); + position.setX(d2); + position.setY(d3); @@ -171,7 +172,7 @@ + position.setYaw(f); + } + EntityPortalExitEvent event = new EntityPortalExitEvent(entity.getBukkitEntity(), from, position, before, velocity); -+ this.a.getServer().getPluginManager().callEvent(event); ++ this.world.getServer().getPluginManager().callEvent(event); + Location to = event.getTo(); + if (event.isCancelled() || to == null || !entity.isAlive()) { + position.setX(from.getX()); @@ -199,7 +200,7 @@ + } + + public boolean createPortal(double x, double y, double z, int b0) { -+ if (this.a.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) { ++ if (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) { + createEndPortal(x, y, z); + return true; + } @@ -216,7 +217,7 @@ int l = i; int i1 = j; int j1 = k; -@@ -176,10 +299,10 @@ +@@ -181,10 +297,10 @@ double d4; for (i2 = i - b0; i2 <= i + b0; ++i2) { @@ -228,8 +229,8 @@ + d2 = (double) j2 + 0.5D - z; // CraftBukkit label271: - for (k2 = this.a.V() - 1; k2 >= 0; --k2) { -@@ -211,7 +334,7 @@ + for (k2 = this.world.Z() - 1; k2 >= 0; --k2) { +@@ -216,7 +332,7 @@ } } @@ -238,7 +239,7 @@ d4 = d1 * d1 + d3 * d3 + d2 * d2; if (d0 < 0.0D || d4 < d0) { d0 = d4; -@@ -228,10 +351,10 @@ +@@ -233,10 +349,10 @@ if (d0 < 0.0D) { for (i2 = i - b0; i2 <= i + b0; ++i2) { @@ -250,8 +251,8 @@ + d2 = (double) j2 + 0.5D - z; // CraftBukkit label219: - for (k2 = this.a.V() - 1; k2 >= 0; --k2) { -@@ -256,7 +379,7 @@ + for (k2 = this.world.Z() - 1; k2 >= 0; --k2) { +@@ -261,7 +377,7 @@ } } @@ -260,3 +261,14 @@ d4 = d1 * d1 + d3 * d3 + d2 * d2; if (d0 < 0.0D || d4 < d0) { d0 = d4; +@@ -362,5 +478,10 @@ + super(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + this.c = i; + } ++ ++ @Override ++ public int compareTo(BaseBlockPosition o) { ++ return this.i(o); ++ } + } + } |