Readded patch to allow for use of custom teleporter for transfering dimensions.
This commit is contained in:
parent
111c5021de
commit
3b18bfae40
2 changed files with 86 additions and 0 deletions
|
@ -64,6 +64,11 @@ public class DimensionManager
|
||||||
return dimensions.get(dim);
|
return dimensions.get(dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static WorldProvider getProvider(int dim)
|
||||||
|
{
|
||||||
|
return getWorld(dim).provider;
|
||||||
|
}
|
||||||
|
|
||||||
public static Integer[] getIDs()
|
public static Integer[] getIDs()
|
||||||
{
|
{
|
||||||
return dimensions.keySet().toArray(new Integer[0]);
|
return dimensions.keySet().toArray(new Integer[0]);
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
--- ../src_base/common/net/minecraft/src/ServerConfigurationManager.java
|
||||||
|
+++ ../src_work/common/net/minecraft/src/ServerConfigurationManager.java
|
||||||
|
@@ -15,6 +15,7 @@
|
||||||
|
import cpw.mods.fml.common.network.FMLNetworkHandler;
|
||||||
|
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
+import net.minecraftforge.common.DimensionManager;
|
||||||
|
|
||||||
|
public abstract class ServerConfigurationManager
|
||||||
|
{
|
||||||
|
@@ -317,6 +318,7 @@
|
||||||
|
|
||||||
|
EntityPlayerMP var6 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.username, (ItemInWorldManager)var5);
|
||||||
|
var6.clonePlayer(par1EntityPlayerMP, par3);
|
||||||
|
+ var6.dimension = par2;
|
||||||
|
var6.entityId = par1EntityPlayerMP.entityId;
|
||||||
|
var6.serverForThisPlayer = par1EntityPlayerMP.serverForThisPlayer;
|
||||||
|
WorldServer var7 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
|
||||||
|
@@ -359,6 +361,11 @@
|
||||||
|
|
||||||
|
public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2)
|
||||||
|
{
|
||||||
|
+ transferPlayerToDimension(par1EntityPlayerMP, par2, new Teleporter());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2, Teleporter teleporter)
|
||||||
|
+ {
|
||||||
|
int var3 = par1EntityPlayerMP.dimension;
|
||||||
|
WorldServer var4 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
|
||||||
|
par1EntityPlayerMP.dimension = par2;
|
||||||
|
@@ -366,33 +373,14 @@
|
||||||
|
par1EntityPlayerMP.serverForThisPlayer.sendPacketToPlayer(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, var5.getWorldInfo().getTerrainType(), var5.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType()));
|
||||||
|
var4.removeEntity(par1EntityPlayerMP);
|
||||||
|
par1EntityPlayerMP.isDead = false;
|
||||||
|
- double var6 = par1EntityPlayerMP.posX;
|
||||||
|
- double var8 = par1EntityPlayerMP.posZ;
|
||||||
|
- double var10 = 8.0D;
|
||||||
|
-
|
||||||
|
- if (par1EntityPlayerMP.dimension == -1)
|
||||||
|
- {
|
||||||
|
- var6 /= var10;
|
||||||
|
- var8 /= var10;
|
||||||
|
- par1EntityPlayerMP.setLocationAndAngles(var6, par1EntityPlayerMP.posY, var8, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
|
||||||
|
-
|
||||||
|
- if (par1EntityPlayerMP.isEntityAlive())
|
||||||
|
- {
|
||||||
|
- var4.updateEntityWithOptionalForce(par1EntityPlayerMP, false);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- else if (par1EntityPlayerMP.dimension == 0)
|
||||||
|
- {
|
||||||
|
- var6 *= var10;
|
||||||
|
- var8 *= var10;
|
||||||
|
- par1EntityPlayerMP.setLocationAndAngles(var6, par1EntityPlayerMP.posY, var8, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
|
||||||
|
-
|
||||||
|
- if (par1EntityPlayerMP.isEntityAlive())
|
||||||
|
- {
|
||||||
|
- var4.updateEntityWithOptionalForce(par1EntityPlayerMP, false);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
+
|
||||||
|
+ WorldProvider pOld = DimensionManager.getProvider(var3);
|
||||||
|
+ WorldProvider pNew = DimensionManager.getProvider(par2);
|
||||||
|
+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor();
|
||||||
|
+ double var6 = par1EntityPlayerMP.posX * moveFactor;
|
||||||
|
+ double var8 = par1EntityPlayerMP.posZ * moveFactor;
|
||||||
|
+
|
||||||
|
+ if (par1EntityPlayerMP.dimension == 1)
|
||||||
|
{
|
||||||
|
ChunkCoordinates var12 = var5.getEntrancePortalLocation();
|
||||||
|
var6 = (double)var12.posX;
|
||||||
|
@@ -416,7 +404,7 @@
|
||||||
|
var5.spawnEntityInWorld(par1EntityPlayerMP);
|
||||||
|
par1EntityPlayerMP.setLocationAndAngles(var6, par1EntityPlayerMP.posY, var8, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
|
||||||
|
var5.updateEntityWithOptionalForce(par1EntityPlayerMP, false);
|
||||||
|
- (new Teleporter()).placeInPortal(var5, par1EntityPlayerMP);
|
||||||
|
+ teleporter.placeInPortal(var5, par1EntityPlayerMP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue