summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2011-11-24 20:00:55 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2011-11-24 20:00:55 +0000
commit47b4406b7e7c183b69bf47222f7cc36e5c696845 (patch)
tree05dcf7c999402c84e6549aa236527c282608c7cc /src/main/java/net
parent61edd3637825ed68784a47caafe7ed947ecc4fb6 (diff)
downloadcraftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.tar
craftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.tar.gz
craftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.tar.lz
craftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.tar.xz
craftbukkit-47b4406b7e7c183b69bf47222f7cc36e5c696845.zip
I've either fixed going to The End, or made it worse. I'm sure we'll find out soon!
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/PortalTravelAgent.java56
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManager.java21
2 files changed, 25 insertions, 52 deletions
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index e7864ea0..ad70041d 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -3,8 +3,13 @@ package net.minecraft.server;
import java.util.Random;
// CraftBukkit start
-import org.bukkit.event.world.PortalCreateEvent;
-import org.bukkit.Bukkit;
+/*
+ * HEAR ME, HE WHOM WISHES TO COMMAND THE UPDATERING
+ *
+ * FOR SOME REASON WE HAVE OUR OWN PORTAL TRAVEL AGENT IN OBC, WE NEED TO UPDATE
+ * THAT WITH ANY NEW UPDATES TO THIS FILE. THIS FILE LEFT HERE AS A REMINDER.
+ *
+ */
// CraftBukkit end
public class PortalTravelAgent {
@@ -247,53 +252,6 @@ public class PortalTravelAgent {
boolean flag;
- // CraftBukkit start - portal create event
- java.util.Collection<org.bukkit.block.Block> blocks = new java.util.HashSet<org.bukkit.block.Block>();
- // Find out what blocks the portal is going to modify, duplicated from below
- org.bukkit.World bworld = world.getWorld();
-
- if (d0 < 0.0D) {
- if (i1 < 70) {
- i1 = 70;
- }
-
- if (i1 > world.height - 10) {
- i1 = world.height - 10;
- }
-
- j5 = i1;
-
- for (l2 = -1; l2 <= 1; ++l2) {
- for (k2 = 1; k2 < 3; ++k2) {
- for (j3 = -1; j3 < 3; ++j3) {
- i3 = i5 + (k2 - 1) * k5 + l2 * l5;
- l3 = j5 + j3;
- k3 = j2 + (k2 - 1) * l5 - l2 * k5;
- blocks.add(bworld.getBlockAt(i3, l3, k3));
- }
- }
- }
- }
-
- for (l2 = 0; l2 < 4; ++l2) {
- for (k2 = 0; k2 < 4; ++k2) {
- for (j3 = -1; j3 < 4; ++j3) {
- i3 = i5 + (k2 - 1) * k5;
- l3 = j5 + j3;
- k3 = j2 + (k2 - 1) * l5;
- blocks.add(bworld.getBlockAt(i3, l3, k3));
- }
- }
- }
-
- PortalCreateEvent event = new PortalCreateEvent(blocks, bworld);
- Bukkit.getServer().getPluginManager().callEvent(event);
-
- if (event.isCancelled()) {
- return true;
- }
- // CraftBukkit end
-
if (d0 < 0.0D) {
if (i1 < 70) {
i1 = 70;
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
index f1a66bfc..1ff21bde 100644
--- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java
+++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
@@ -305,7 +305,7 @@ public class ServerConfigurationManager {
public void a(EntityPlayer entityplayer, int i) {
// CraftBukkit start -- Replaced the standard handling of portals with a more customised method.
- int dimension = entityplayer.dimension;
+ int dimension = i;
WorldServer fromWorld = this.server.getWorldServer(dimension);
WorldServer toWorld = null;
if (dimension < 10) {
@@ -315,13 +315,28 @@ public class ServerConfigurationManager {
}
}
}
- double blockRatio = dimension == -1 ? 8 : 0.125;
Location fromLocation = new Location(fromWorld.getWorld(), entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
- Location toLocation = toWorld == null ? null : new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch);
+ Location toLocation = null;
+
+ if (toWorld != null) {
+ if ((dimension == -1) || (dimension == 0)) {
+ double blockRatio = dimension == 0 ? 8 : 0.125;
+
+ toLocation = toWorld == null ? null : new Location(toWorld.getWorld(), (entityplayer.locX * blockRatio), entityplayer.locY, (entityplayer.locZ * blockRatio), entityplayer.yaw, entityplayer.pitch);
+ } else {
+ ChunkCoordinates coords = toWorld.d();
+ toLocation = new Location(toWorld.getWorld(), coords.x, coords.y, coords.z, 90, 0);
+ }
+ }
org.bukkit.craftbukkit.PortalTravelAgent pta = new org.bukkit.craftbukkit.PortalTravelAgent();
PlayerPortalEvent event = new PlayerPortalEvent((Player) entityplayer.getBukkitEntity(), fromLocation, toLocation, pta);
+
+ if (entityplayer.dimension == 1) {
+ event.useTravelAgent(false);
+ }
+
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled() || event.getTo() == null) {
return;