Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Updates an entity's position and rotation as specified by the packet
- */
- public void handleEntityTeleport(S18PacketEntityTeleport packetIn)
- {
- PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
- Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
- if (entity != null)
- {
- entity.serverPosX = packetIn.getX();
- entity.serverPosY = packetIn.getY();
- entity.serverPosZ = packetIn.getZ();
- double d0 = (double)entity.serverPosX / 32.0D;
- double d1 = (double)entity.serverPosY / 32.0D;
- double d2 = (double)entity.serverPosZ / 32.0D;
- float f = (float)(packetIn.getYaw() * 360) / 256.0F;
- float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
- if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D)
- {
- entity.setPositionAndRotation2(entity.posX, entity.posY, entity.posZ, f, f1, 3, true);
- }
- else
- {
- entity.setPositionAndRotation2(d0, d1, d2, f, f1, 3, true);
- }
- if(entity == Minecraft.getMinecraft().thePlayer) {
- PlayerHandler.yaw = f;
- PlayerHandler.pitch = f1;
- }
- entity.onGround = packetIn.getOnGround();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement