Commits
md_5 authored ab83272e2a0
78 78 | + Location exit = new Location(this.world.getWorld(), found.getX(), found.getY(), found.getZ(), f, entity.pitch); |
79 79 | + Vector velocity = entity.getBukkitEntity().getVelocity(); |
80 80 | + this.adjustExit(entity, exit, velocity); |
81 81 | + entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); |
82 82 | + if (entity.motX != velocity.getX() || entity.motY != velocity.getY() || entity.motZ != velocity.getZ()) { |
83 83 | + entity.getBukkitEntity().setVelocity(velocity); |
84 84 | + } |
85 85 | + return true; |
86 86 | + } |
87 87 | + |
88 - | + public BlockPosition findPortal(double x, double y, double z, int short1) { |
88 + | + public BlockPosition findPortal(double x, double y, double z, int radius) { |
89 89 | + if (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) { |
90 90 | + return this.findEndPortal(this.world.worldProvider.h()); |
91 91 | + } |
92 92 | + // CraftBukkit end |
93 93 | double d0 = -1.0D; |
94 94 | - int i = MathHelper.floor(entity.locX); |
95 95 | - int j = MathHelper.floor(entity.locZ); |
96 96 | + // CraftBukkit start |
97 97 | + int i = MathHelper.floor(x); |
98 98 | + int j = MathHelper.floor(z); |
99 99 | + // CraftBukkit end |
100 100 | boolean flag1 = true; |
101 101 | Object object = BlockPosition.ZERO; |
102 102 | long k = ChunkCoordIntPair.a(i, j); |
103 - | |
103 + | |
104 104 | portaltravelagent_chunkcoordinatesportal.c = this.world.getTime(); |
105 105 | flag1 = false; |
106 106 | } else { |
107 107 | - BlockPosition blockposition = new BlockPosition(entity); |
108 108 | + BlockPosition blockposition = new BlockPosition(x, y, z); // CraftBukkit |
109 109 | |
110 - | for (int l = -128; l <= 128; ++l) { |
110 + | - for (int l = -128; l <= 128; ++l) { |
111 + | + for (int l = -radius; l <= radius; ++l) { |
111 112 | BlockPosition blockposition1; |
113 + | |
114 + | - for (int i1 = -128; i1 <= 128; ++i1) { |
115 + | + for (int i1 = -radius; i1 <= radius; ++i1) { |
116 + | for (BlockPosition blockposition2 = blockposition.a(l, this.world.Z() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) { |
117 + | blockposition1 = blockposition2.down(); |
118 + | if (this.world.getType(blockposition2).getBlock() == Blocks.PORTAL) { |
112 119 | |
113 120 | this.c.put(k, new PortalTravelAgent.ChunkCoordinatesPortal((BlockPosition) object, this.world.getTime())); |
114 121 | this.d.add(Long.valueOf(k)); |
115 122 | } |
116 123 | + // CraftBukkit start - Move entity teleportation logic into exit |
117 124 | + return (BlockPosition) object; |
118 125 | + } else { |
119 126 | + return null; |
120 127 | + } |
121 128 | + } |