Fixed teleported crash
This commit is contained in:
parent
cf73d1f2c0
commit
e9e4d381f2
1 changed files with 17 additions and 13 deletions
|
@ -45,6 +45,14 @@ public class PacketPortableTeleport implements IMekanismPacket
|
||||||
{
|
{
|
||||||
Coord4D coords = MekanismUtils.getClosestCoords(new Teleporter.Code(item.getDigit(itemstack, 0), item.getDigit(itemstack, 1), item.getDigit(itemstack, 2), item.getDigit(itemstack, 3)), player);
|
Coord4D coords = MekanismUtils.getClosestCoords(new Teleporter.Code(item.getDigit(itemstack, 0), item.getDigit(itemstack, 1), item.getDigit(itemstack, 2), item.getDigit(itemstack, 3)), player);
|
||||||
|
|
||||||
|
World teleWorld = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(coords.dimensionId);
|
||||||
|
TileEntityTeleporter teleporter = (TileEntityTeleporter)coords.getTileEntity(teleWorld);
|
||||||
|
|
||||||
|
if(teleporter != null)
|
||||||
|
{
|
||||||
|
teleporter.didTeleport.add(player);
|
||||||
|
teleporter.teleDelay = 5;
|
||||||
|
|
||||||
item.setEnergy(itemstack, item.getEnergy(itemstack) - item.calculateEnergyCost(player, coords));
|
item.setEnergy(itemstack, item.getEnergy(itemstack) - item.calculateEnergyCost(player, coords));
|
||||||
|
|
||||||
if(world.provider.dimensionId != coords.dimensionId)
|
if(world.provider.dimensionId != coords.dimensionId)
|
||||||
|
@ -52,11 +60,6 @@ public class PacketPortableTeleport implements IMekanismPacket
|
||||||
((EntityPlayerMP)player).travelToDimension(coords.dimensionId);
|
((EntityPlayerMP)player).travelToDimension(coords.dimensionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
World teleWorld = FMLCommonHandler.instance().getMinecraftServerInstance().worldServerForDimension(coords.dimensionId);
|
|
||||||
TileEntityTeleporter teleporter = (TileEntityTeleporter)coords.getTileEntity(teleWorld);
|
|
||||||
|
|
||||||
teleporter.didTeleport.add(player);
|
|
||||||
teleporter.teleDelay = 5;
|
|
||||||
((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(coords.xCoord+0.5, coords.yCoord+1, coords.zCoord+0.5, player.rotationYaw, player.rotationPitch);
|
((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(coords.xCoord+0.5, coords.yCoord+1, coords.zCoord+0.5, player.rotationYaw, player.rotationPitch);
|
||||||
|
|
||||||
world.playSoundAtEntity(player, "mob.endermen.portal", 1.0F, 1.0F);
|
world.playSoundAtEntity(player, "mob.endermen.portal", 1.0F, 1.0F);
|
||||||
|
@ -64,6 +67,7 @@ public class PacketPortableTeleport implements IMekanismPacket
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void write(DataOutputStream dataStream) throws Exception {}
|
public void write(DataOutputStream dataStream) throws Exception {}
|
||||||
|
|
Loading…
Reference in a new issue