GeoNodeLoc.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.pathfinding.geonodes;
  16. import com.l2jserver.gameserver.model.L2World;
  17. import com.l2jserver.gameserver.pathfinding.AbstractNodeLoc;
  18. /**
  19. * @author -Nemesiss-
  20. */
  21. public class GeoNodeLoc extends AbstractNodeLoc
  22. {
  23. private final short _x;
  24. private final short _y;
  25. private final short _z;
  26. public GeoNodeLoc(short x, short y, short z)
  27. {
  28. _x = x;
  29. _y = y;
  30. _z = z;
  31. }
  32. /**
  33. * @see com.l2jserver.gameserver.pathfinding.AbstractNodeLoc#getX()
  34. */
  35. @Override
  36. public int getX()
  37. {
  38. return L2World.MAP_MIN_X + (_x * 128) + 48;
  39. }
  40. /**
  41. * @see com.l2jserver.gameserver.pathfinding.AbstractNodeLoc#getY()
  42. */
  43. @Override
  44. public int getY()
  45. {
  46. return L2World.MAP_MIN_Y + (_y * 128) + 48;
  47. }
  48. /**
  49. * @see com.l2jserver.gameserver.pathfinding.AbstractNodeLoc#getZ()
  50. */
  51. @Override
  52. public short getZ()
  53. {
  54. return _z;
  55. }
  56. @Override
  57. public void setZ(short z)
  58. {
  59. //
  60. }
  61. @Override
  62. public int getNodeX()
  63. {
  64. return _x;
  65. }
  66. @Override
  67. public int getNodeY()
  68. {
  69. return _y;
  70. }
  71. /**
  72. * @see java.lang.Object#hashCode()
  73. */
  74. @Override
  75. public int hashCode()
  76. {
  77. final int prime = 31;
  78. int result = 1;
  79. result = (prime * result) + _x;
  80. result = (prime * result) + _y;
  81. result = (prime * result) + _z;
  82. return result;
  83. }
  84. /**
  85. * @see java.lang.Object#equals(java.lang.Object)
  86. */
  87. @Override
  88. public boolean equals(Object obj)
  89. {
  90. if (this == obj)
  91. {
  92. return true;
  93. }
  94. if (obj == null)
  95. {
  96. return false;
  97. }
  98. if (!(obj instanceof GeoNodeLoc))
  99. {
  100. return false;
  101. }
  102. final GeoNodeLoc other = (GeoNodeLoc) obj;
  103. if (_x != other._x)
  104. {
  105. return false;
  106. }
  107. if (_y != other._y)
  108. {
  109. return false;
  110. }
  111. if (_z != other._z)
  112. {
  113. return false;
  114. }
  115. return true;
  116. }
  117. }