GeoNodeLoc.java 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. *
  20. * @author -Nemesiss-
  21. */
  22. public class GeoNodeLoc extends AbstractNodeLoc
  23. {
  24. private final short _x;
  25. private final short _y;
  26. private final short _z;
  27. public GeoNodeLoc(short x, short y, short z)
  28. {
  29. _x = x;
  30. _y = y;
  31. _z = z;
  32. }
  33. /**
  34. * @see com.l2jserver.gameserver.pathfinding.AbstractNodeLoc#getX()
  35. */
  36. @Override
  37. public int getX()
  38. {
  39. return L2World.MAP_MIN_X + _x * 128 + 48 ;
  40. }
  41. /**
  42. * @see com.l2jserver.gameserver.pathfinding.AbstractNodeLoc#getY()
  43. */
  44. @Override
  45. public int getY()
  46. {
  47. return L2World.MAP_MIN_Y + _y * 128 + 48 ;
  48. }
  49. /**
  50. * @see com.l2jserver.gameserver.pathfinding.AbstractNodeLoc#getZ()
  51. */
  52. @Override
  53. public short getZ()
  54. {
  55. return _z;
  56. }
  57. @Override
  58. public void setZ(short z)
  59. {
  60. //
  61. }
  62. @Override
  63. public int getNodeX()
  64. {
  65. return _x;
  66. }
  67. @Override
  68. public int getNodeY()
  69. {
  70. return _y;
  71. }
  72. /**
  73. * @see java.lang.Object#hashCode()
  74. */
  75. @Override
  76. public int hashCode()
  77. {
  78. final int prime = 31;
  79. int result = 1;
  80. result = prime * result + _x;
  81. result = prime * result + _y;
  82. result = prime * result + _z;
  83. return result;
  84. }
  85. /**
  86. * @see java.lang.Object#equals(java.lang.Object)
  87. */
  88. @Override
  89. public boolean equals(Object obj)
  90. {
  91. if (this == obj)
  92. return true;
  93. if (obj == null)
  94. return false;
  95. if (!(obj instanceof GeoNodeLoc))
  96. return false;
  97. final GeoNodeLoc other = (GeoNodeLoc) obj;
  98. if (_x != other._x)
  99. return false;
  100. if (_y != other._y)
  101. return false;
  102. if (_z != other._z)
  103. return false;
  104. return true;
  105. }
  106. }