Permalink
Browse files

Refactor vector system to be cleaner

- Move Vector, etc. into `.math` package
- Drop many methods that will be auto-promoted anyways, eg. with
`divide(int)` and `divide(double)` the first is now gone.
- Take Block vectors into their own class hierarchy
- Make it clear throughout the API what takes blockvectors
- many more improvements
  • Loading branch information...
kenzierocks committed Oct 14, 2018
1 parent 93de97d commit 2ec5217e7bbd6c89ce2b268a501cfa719249ffe0
Showing with 4,231 additions and 3,919 deletions.
  1. +34 −6 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitAdapter.java
  2. +10 −8 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java
  3. +24 −23 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java
  4. +5 −5 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/EditSessionBlockChangeDelegate.java
  5. +2 −2 worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java
  6. +3 −3 worldedit-core/src/main/java/com/sk89q/jnbt/NBTUtils.java
  7. +20 −20 worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLNode.java
  8. +0 −97 worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector.java
  9. +0 −93 worldedit-core/src/main/java/com/sk89q/worldedit/BlockVector2D.java
  10. +134 −136 worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java
  11. +5 −4 worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java
  12. +15 −14 worldedit-core/src/main/java/com/sk89q/worldedit/PlayerDirection.java
  13. +0 −846 worldedit-core/src/main/java/com/sk89q/worldedit/Vector.java
  14. +0 −691 worldedit-core/src/main/java/com/sk89q/worldedit/Vector2D.java
  15. +3 −2 worldedit-core/src/main/java/com/sk89q/worldedit/WorldEdit.java
  16. +8 −8 worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java
  17. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java
  18. +7 −7 worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java
  19. +9 −9 worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java
  20. +17 −22 worldedit-core/src/main/java/com/sk89q/worldedit/command/FlattenedClipboardTransform.java
  21. +34 −33 worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java
  22. +21 −20 worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java
  23. +48 −50 worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java
  24. +8 −8 worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java
  25. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/argument/ItemUseParser.java
  26. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/command/composition/DeformCommand.java
  27. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/AreaPickaxe.java
  28. +4 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockDataCyler.java
  29. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BlockReplacer.java
  30. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/BrushTool.java
  31. +7 −4 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/DistanceWand.java
  32. +17 −17 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloatingTreeRemover.java
  33. +12 −13 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/FloodFillTool.java
  34. +9 −6 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/LongRangeBuildTool.java
  35. +4 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/QueryTool.java
  36. +13 −13 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/RecursivePickaxe.java
  37. +4 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/SinglePickaxe.java
  38. +1 −1 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/TreePlanter.java
  39. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/Brush.java
  40. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ButcherBrush.java
  41. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java
  42. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/CylinderBrush.java
  43. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/GravityBrush.java
  44. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java
  45. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java
  46. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/OperationFactoryBrush.java
  47. +7 −5 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SmoothBrush.java
  48. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java
  49. +6 −5 worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java
  50. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/event/extent/EditSessionEvent.java
  51. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java
  52. +4 −3 worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultMaskParser.java
  53. +23 −22 worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java
  54. +9 −6 worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java
  55. +4 −3 worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlayerProxy.java
  56. +10 −10 worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java
  57. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java
  58. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/extent/Extent.java
  59. +6 −6 worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java
  60. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/extent/MaskingExtent.java
  61. +12 −14 worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java
  62. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/extent/OutputExtent.java
  63. +23 −23 worldedit-core/src/main/java/com/sk89q/worldedit/extent/buffer/ForgetfulExtentBuffer.java
  64. +8 −9 worldedit-core/src/main/java/com/sk89q/worldedit/extent/cache/LastAccessExtentCache.java
  65. +19 −19 worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java
  66. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
  67. +10 −11 worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java
  68. +9 −10 worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java
  69. +6 −7 worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java
  70. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java
  71. +8 −9 worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/ChunkBatchingExtent.java
  72. +14 −14 worldedit-core/src/main/java/com/sk89q/worldedit/extent/reorder/MultiStageReorder.java
  73. +11 −10 worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java
  74. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java
  75. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/DataValidatorExtent.java
  76. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/BlockQuirkExtent.java
  77. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/ChunkLoadingExtent.java
  78. +5 −5 worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/FastModeExtent.java
  79. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/extent/world/SurvivalModeExtent.java
  80. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/CombinedRegionFunction.java
  81. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionFunction.java
  82. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/function/FlatRegionMaskingFilter.java
  83. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/function/GroundFunction.java
  84. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/function/LayerFunction.java
  85. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionFunction.java
  86. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/function/RegionMaskingFilter.java
  87. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/biome/BiomeReplace.java
  88. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockDistributionCounter.java
  89. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/block/BlockReplace.java
  90. +6 −5 worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Counter.java
  91. +10 −9 worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java
  92. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/function/block/Naturalizer.java
  93. +12 −11 worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java
  94. +17 −17 worldedit-core/src/main/java/com/sk89q/worldedit/function/factory/Deform.java
  95. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/FloraGenerator.java
  96. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/ForestGenerator.java
  97. +6 −6 worldedit-core/src/main/java/com/sk89q/worldedit/function/generator/GardenPatchGenerator.java
  98. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BiomeMask2D.java
  99. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockCategoryMask.java
  100. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockMask.java
  101. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BlockTypeMask.java
  102. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/BoundedHeightMask.java
  103. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExistingBlockMask.java
  104. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask.java
  105. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/ExpressionMask2D.java
  106. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask.java
  107. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Mask2D.java
  108. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection.java
  109. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskIntersection2D.java
  110. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion.java
  111. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/MaskUnion2D.java
  112. +10 −10 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/Masks.java
  113. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter.java
  114. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/NoiseFilter2D.java
  115. +7 −7 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask.java
  116. +6 −6 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/OffsetMask2D.java
  117. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/RegionMask.java
  118. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java
  119. +8 −7 worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/ForwardExtentCopy.java
  120. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java
  121. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/ClipboardPattern.java
  122. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/Pattern.java
  123. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RandomPattern.java
  124. +9 −9 worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/RepeatingExtentPattern.java
  125. +6 −6 worldedit-core/src/main/java/com/sk89q/worldedit/function/util/FlatRegionOffset.java
  126. +6 −6 worldedit-core/src/main/java/com/sk89q/worldedit/function/util/RegionOffset.java
  127. +27 −28 worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java
  128. +8 −8 worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/DownwardVisitor.java
  129. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/FlatRegionVisitor.java
  130. +5 −5 worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/LayerVisitor.java
  131. +7 −7 worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/NonRisingVisitor.java
  132. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RecursiveVisitor.java
  133. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/RegionVisitor.java
  134. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/history/change/BlockChange.java
  135. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/history/changeset/BlockOptimizedHistory.java
  136. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/internal/annotation/Direction.java
  137. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/CommandLoggingHandler.java
  138. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java
  139. +5 −5 worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionCylinderEvent.java
  140. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionEllipsoidPointEvent.java
  141. +12 −12 worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPoint2DEvent.java
  142. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/SelectionPointEvent.java
  143. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/internal/cui/ServerCUIHandler.java
  144. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/runtime/Functions.java
  145. +529 −0 worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector2d.java
  146. +613 −0 worldedit-core/src/main/java/com/sk89q/worldedit/math/BlockVector3d.java
  147. +471 −0 worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector2d.java
  148. +596 −0 worldedit-core/src/main/java/com/sk89q/worldedit/math/Vector3d.java
  149. +8 −8 worldedit-core/src/main/java/com/sk89q/worldedit/math/convolution/HeightMap.java
  150. +7 −7 worldedit-core/src/main/java/com/sk89q/worldedit/math/geom/Polygons.java
  151. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Interpolation.java
  152. +28 −28 ...dedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/KochanekBartelsInterpolation.java
  153. +9 −9 worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/LinearInterpolation.java
  154. +6 −6 worldedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/Node.java
  155. +3 −3 ...dedit-core/src/main/java/com/sk89q/worldedit/math/interpolation/ReparametrisingInterpolation.java
  156. +5 −4 worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/JLibNoiseGenerator.java
  157. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/NoiseGenerator.java
  158. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/math/noise/RandomNoise.java
  159. +10 −5 worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/AffineTransform.java
  160. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/CombinedTransform.java
  161. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Identity.java
  162. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/math/transform/Transform.java
  163. +41 −42 worldedit-core/src/main/java/com/sk89q/worldedit/regions/AbstractRegion.java
  164. +41 −39 worldedit-core/src/main/java/com/sk89q/worldedit/regions/ConvexPolyhedralRegion.java
  165. +88 −109 worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java
  166. +47 −47 worldedit-core/src/main/java/com/sk89q/worldedit/regions/CylinderRegion.java
  167. +38 −39 worldedit-core/src/main/java/com/sk89q/worldedit/regions/EllipsoidRegion.java
  168. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/regions/FlatRegion.java
  169. +19 −25 worldedit-core/src/main/java/com/sk89q/worldedit/regions/NullRegion.java
  170. +38 −45 worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java
  171. +14 −15 worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java
  172. +12 −13 worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionIntersection.java
  173. +6 −7 worldedit-core/src/main/java/com/sk89q/worldedit/regions/RegionSelector.java
  174. +24 −24 worldedit-core/src/main/java/com/sk89q/worldedit/regions/TransformRegion.java
  175. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CuboidRegionFactory.java
  176. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/CylinderRegionFactory.java
  177. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/RegionFactory.java
  178. +4 −3 worldedit-core/src/main/java/com/sk89q/worldedit/regions/factory/SphereRegionFactory.java
  179. +8 −8 worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegion3DIterator.java
  180. +10 −14 worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java
  181. +7 −8 worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/RegionIterator.java
  182. +6 −6 worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Edge.java
  183. +8 −8 worldedit-core/src/main/java/com/sk89q/worldedit/regions/polyhedron/Triangle.java
  184. +17 −18 ...dedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java
  185. +20 −21 worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CuboidRegionSelector.java
  186. +28 −27 worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/CylinderRegionSelector.java
  187. +24 −24 worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/EllipsoidRegionSelector.java
  188. +16 −17 worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ExtendingCuboidRegionSelector.java
  189. +19 −20 worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/Polygonal2DRegionSelector.java
  190. +10 −9 worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/SphereRegionSelector.java
  191. +5 −5 worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryBiomeShape.java
  192. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/ArbitraryShape.java
  193. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/RegionShape.java
  194. +10 −10 worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java
  195. +3 −3 worldedit-core/src/main/java/com/sk89q/worldedit/session/PasteBuilder.java
  196. +14 −15 worldedit-core/src/main/java/com/sk89q/worldedit/session/request/RequestSelection.java
  197. +39 −29 worldedit-core/src/main/java/com/sk89q/worldedit/util/Direction.java
  198. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/util/LocatedBlock.java
  199. +25 −58 worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java
  200. +14 −13 worldedit-core/src/main/java/com/sk89q/worldedit/util/TargetBlock.java
  201. +12 −12 worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java
  202. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/LocatedBlockList.java
  203. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/GsonUtil.java
  204. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/util/gson/VectorAdapter.java
  205. +18 −17 worldedit-core/src/main/java/com/sk89q/worldedit/world/AbstractWorld.java
  206. +13 −12 worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java
  207. +19 −18 worldedit-core/src/main/java/com/sk89q/worldedit/world/World.java
  208. +14 −15 worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java
  209. +9 −10 worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java
  210. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java
  211. +10 −11 worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java
  212. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java
  213. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledItemData.java
  214. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/LegacyMapper.java
  215. +16 −18 worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java
  216. +6 −10 worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/ChunkStore.java
  217. +4 −5 worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/LegacyChunkStore.java
  218. +4 −5 worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionChunkStore.java
  219. +2 −2 worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/McRegionReader.java
  220. +4 −4 worldedit-core/src/main/java/com/sk89q/worldedit/world/storage/MissingChunkException.java
  221. +0 −152 worldedit-core/src/test/java/com/sk89q/worldedit/VectorTest.java
  222. +11 −11 worldedit-core/src/test/java/com/sk89q/worldedit/util/LocationTest.java
  223. +8 −7 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeAdapter.java
  224. +2 −2 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeEntity.java
  225. +9 −6 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgePlayer.java
  226. +25 −26 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java
  227. +6 −5 worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityUtils.java
  228. +7 −6 worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongePlayer.java
  229. +16 −15 worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java
  230. +4 −4 worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/adapter/SpongeImplAdapter.java
@@ -23,13 +23,14 @@
import com.google.common.base.Function;
import com.sk89q.worldedit.NotABlockException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extension.input.InputParseException;
import com.sk89q.worldedit.extension.input.ParserContext;
import com.sk89q.worldedit.math.BlockVector3d;
import com.sk89q.worldedit.math.Vector3d;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState;
@@ -42,6 +43,7 @@
import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
@@ -159,7 +161,7 @@ public static Player adapt(com.sk89q.worldedit.entity.Player player) {
*/
public static Location adapt(org.bukkit.Location location) {
checkNotNull(location);
Vector position = asVector(location);
Vector3d position = asVector(location);
return new com.sk89q.worldedit.util.Location(
adapt(location.getWorld()),
position,
@@ -175,7 +177,7 @@ public static Location adapt(org.bukkit.Location location) {
*/
public static org.bukkit.Location adapt(Location location) {
checkNotNull(location);
Vector position = location.toVector();
Vector3d position = location.toVector();
return new org.bukkit.Location(
adapt((World) location.getExtent()),
position.getX(), position.getY(), position.getZ(),
@@ -190,7 +192,22 @@ public static Location adapt(org.bukkit.Location location) {
* @param position the WorldEdit position
* @return a Bukkit location
*/
public static org.bukkit.Location adapt(org.bukkit.World world, Vector position) {
public static org.bukkit.Location adapt(org.bukkit.World world, Vector3d position) {
checkNotNull(world);
checkNotNull(position);
return new org.bukkit.Location(
world,
position.getX(), position.getY(), position.getZ());
}
/**
* Create a Bukkit location from a WorldEdit position with a Bukkit world.
*
* @param world the Bukkit world
* @param position the WorldEdit position
* @return a Bukkit location
*/
public static org.bukkit.Location adapt(org.bukkit.World world, BlockVector3d position) {
checkNotNull(world);
checkNotNull(position);
return new org.bukkit.Location(
@@ -221,9 +238,20 @@ public static Location adapt(org.bukkit.Location location) {
* @param location The Bukkit location
* @return a WorldEdit vector
*/
public static Vector asVector(org.bukkit.Location location) {
public static Vector3d asVector(org.bukkit.Location location) {
checkNotNull(location);
return new Vector3d(location.getX(), location.getY(), location.getZ());
}
/**
* Create a WorldEdit BlockVector from a Bukkit location.
*
* @param location The Bukkit location
* @return a WorldEdit vector
*/
public static BlockVector3d asBlockVector(org.bukkit.Location location) {
checkNotNull(location);
return new Vector(location.getX(), location.getY(), location.getZ());
return new BlockVector3d(location.getX(), location.getY(), location.getZ());
}
/**
@@ -20,22 +20,24 @@
package com.sk89q.worldedit.bukkit;
import com.sk89q.util.StringUtil;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.extension.platform.AbstractPlayerActor;
import com.sk89q.worldedit.extent.inventory.BlockBag;
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.math.BlockVector3d;
import com.sk89q.worldedit.math.Vector3d;
import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@@ -115,7 +117,7 @@ public void printError(String msg) {
}
@Override
public void setPosition(Vector pos, float pitch, float yaw) {
public void setPosition(Vector3d pos, float pitch, float yaw) {
player.teleport(new Location(player.getWorld(), pos.getX(), pos.getY(),
pos.getZ(), yaw, pitch));
}
@@ -173,7 +175,7 @@ public void floatAt(int x, int y, int z, boolean alwaysGlass) {
return;
}
setPosition(new Vector(x + 0.5, y, z + 0.5));
setPosition(new Vector3d(x + 0.5, y, z + 0.5));
player.setFlying(true);
}
@@ -185,7 +187,7 @@ public BaseEntity getState() {
@Override
public com.sk89q.worldedit.util.Location getLocation() {
Location nativeLocation = player.getLocation();
Vector position = BukkitAdapter.asVector(nativeLocation);
Vector3d position = BukkitAdapter.asVector(nativeLocation);
return new com.sk89q.worldedit.util.Location(
getWorld(),
position,
@@ -243,7 +245,7 @@ public boolean isPersistent() {
}
@Override
public void sendFakeBlock(Vector pos, BlockStateHolder block) {
public void sendFakeBlock(BlockVector3d pos, BlockStateHolder block) {
Location loc = new Location(player.getWorld(), pos.getX(), pos.getY(), pos.getZ());
if (block == null) {
player.sendBlockChange(loc, player.getWorld().getBlockAt(loc).getBlockData());
@@ -252,7 +254,7 @@ public void sendFakeBlock(Vector pos, BlockStateHolder block) {
if (block instanceof BaseBlock && ((BaseBlock) block).hasNbtData()) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
adapter.sendFakeNBT(player, pos, ((BaseBlock) block).getNbtData());
adapter.sendFakeNBT(player, pos.toVector3d(), ((BaseBlock) block).getNbtData());
if (block.getBlockType() == BlockTypes.STRUCTURE_BLOCK) {
adapter.sendFakeOP(player);
}
@@ -21,16 +21,16 @@
import static com.google.common.base.Preconditions.checkNotNull;
import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.history.change.BlockChange;
import com.sk89q.worldedit.math.BlockVector2d;
import com.sk89q.worldedit.math.BlockVector3d;
import com.sk89q.worldedit.math.Vector3d;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.TreeGenerator;
import com.sk89q.worldedit.world.AbstractWorld;
@@ -39,6 +39,7 @@
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.weather.WeatherType;
import com.sk89q.worldedit.world.weather.WeatherTypes;
import org.bukkit.Effect;
import org.bukkit.TreeType;
import org.bukkit.World;
@@ -90,7 +91,7 @@ public BukkitWorld(World world) {
List<Entity> ents = world.getEntities();
List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>();
for (Entity ent : ents) {
if (region.contains(BukkitAdapter.asVector(ent.getLocation()))) {
if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) {
entities.add(BukkitAdapter.adapt(ent));
}
}
@@ -159,22 +160,22 @@ public String getName() {
}
@Override
public int getBlockLightLevel(Vector pt) {
public int getBlockLightLevel(BlockVector3d pt) {
return getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel();
}
@Override
public boolean regenerate(Region region, EditSession editSession) {
BlockStateHolder[] history = new BlockStateHolder[16 * 16 * (getMaxY() + 1)];
for (Vector2D chunk : region.getChunks()) {
Vector min = new Vector(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
for (BlockVector2d chunk : region.getChunks()) {
BlockVector3d min = new BlockVector3d(chunk.getBlockX() * 16, 0, chunk.getBlockZ() * 16);
// First save all the blocks inside
for (int x = 0; x < 16; ++x) {
for (int y = 0; y < (getMaxY() + 1); ++y) {
for (int z = 0; z < 16; ++z) {
Vector pt = min.add(x, y, z);
BlockVector3d pt = min.add(x, y, z);
int index = y * 16 * 16 + z * 16 + x;
history[index] = editSession.getFullBlock(pt);
}
@@ -191,14 +192,14 @@ public boolean regenerate(Region region, EditSession editSession) {
for (int x = 0; x < 16; ++x) {
for (int y = 0; y < (getMaxY() + 1); ++y) {
for (int z = 0; z < 16; ++z) {
Vector pt = min.add(x, y, z);
BlockVector3d pt = min.add(x, y, z);
int index = y * 16 * 16 + z * 16 + x;
// We have to restore the block if it was outside
if (!region.contains(pt)) {
editSession.smartSetBlock(pt, history[index]);
} else { // Otherwise fool with history
editSession.getChangeSet().add(new BlockChange(pt.toBlockVector(), history[index], editSession.getFullBlock(pt)));
editSession.getChangeSet().add(new BlockChange(pt, history[index], editSession.getFullBlock(pt)));
}
}
}
@@ -237,7 +238,7 @@ private Inventory getBlockInventory(Chest chest) {
}
@Override
public boolean clearContainerBlockContents(Vector pt) {
public boolean clearContainerBlockContents(BlockVector3d pt) {
Block block = getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
if (block == null) {
return false;
@@ -291,21 +292,21 @@ public static TreeType toBukkitTreeType(TreeGenerator.TreeType type) {
}
@Override
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, Vector pt) {
public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3d pt) {
World world = getWorld();
TreeType bukkitType = toBukkitTreeType(type);
return type != null && world.generateTree(BukkitAdapter.adapt(world, pt), bukkitType,
new EditSessionBlockChangeDelegate(editSession));
}
@Override
public void dropItem(Vector pt, BaseItemStack item) {
public void dropItem(Vector3d pt, BaseItemStack item) {
World world = getWorld();
world.dropItemNaturally(BukkitAdapter.adapt(world, pt), BukkitAdapter.adapt(item));
}
@Override
public void checkLoadedChunk(Vector pt) {
public void checkLoadedChunk(BlockVector3d pt) {
World world = getWorld();
if (!world.isChunkLoaded(pt.getBlockX() >> 4, pt.getBlockZ() >> 4)) {
@@ -337,15 +338,15 @@ public int getMaxY() {
}
@Override
public void fixAfterFastMode(Iterable<BlockVector2D> chunks) {
public void fixAfterFastMode(Iterable<BlockVector2d> chunks) {
World world = getWorld();
for (BlockVector2D chunkPos : chunks) {
for (BlockVector2d chunkPos : chunks) {
world.refreshChunk(chunkPos.getBlockX(), chunkPos.getBlockZ());
}
}
@Override
public boolean playEffect(Vector position, int type, int data) {
public boolean playEffect(Vector3d position, int type, int data) {
World world = getWorld();
final Effect effect = effects.get(type);
@@ -404,18 +405,18 @@ public void setWeather(WeatherType weatherType, long duration) {
}
@Override
public void simulateBlockMine(Vector pt) {
public void simulateBlockMine(BlockVector3d pt) {
getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally();
}
@Override
public com.sk89q.worldedit.world.block.BlockState getBlock(Vector position) {
public com.sk89q.worldedit.world.block.BlockState getBlock(BlockVector3d position) {
Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
return BukkitAdapter.adapt(bukkitBlock.getBlockData());
}
@Override
public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
public boolean setBlock(BlockVector3d position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
try {
@@ -438,7 +439,7 @@ public boolean setBlock(Vector position, BlockStateHolder block, boolean notifyA
}
@Override
public BaseBlock getFullBlock(Vector position) {
public BaseBlock getFullBlock(BlockVector3d position) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position));
@@ -448,7 +449,7 @@ public BaseBlock getFullBlock(Vector position) {
}
@Override
public BaseBiome getBiome(Vector2D position) {
public BaseBiome getBiome(BlockVector2d position) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
int id = adapter.getBiomeId(getWorld().getBiome(position.getBlockX(), position.getBlockZ()));
@@ -459,7 +460,7 @@ public BaseBiome getBiome(Vector2D position) {
}
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
public boolean setBiome(BlockVector2d position, BaseBiome biome) {
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
if (adapter != null) {
Biome bukkitBiome = adapter.getBiome(biome.getId());
@@ -21,8 +21,8 @@
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.math.BlockVector3d;
import org.bukkit.BlockChangeDelegate;
import org.bukkit.block.data.BlockData;
@@ -40,7 +40,7 @@ public EditSessionBlockChangeDelegate(EditSession editSession) {
@Override
public boolean setBlockData(int x, int y, int z, BlockData blockData) {
try {
editSession.setBlock(new Vector(x, y, z), BukkitAdapter.adapt(blockData));
editSession.setBlock(new BlockVector3d(x, y, z), BukkitAdapter.adapt(blockData));
} catch (MaxChangedBlocksException e) {
return false;
}
@@ -49,7 +49,7 @@ public boolean setBlockData(int x, int y, int z, BlockData blockData) {
@Override
public BlockData getBlockData(int x, int y, int z) {
return BukkitAdapter.adapt(editSession.getBlock(new Vector(x, y, z)));
return BukkitAdapter.adapt(editSession.getBlock(new BlockVector3d(x, y, z)));
}
@Override
@@ -59,7 +59,7 @@ public int getHeight() {
@Override
public boolean isEmpty(int x, int y, int z) {
return editSession.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isAir();
return editSession.getBlock(new BlockVector3d(x, y, z)).getBlockType().getMaterial().isAir();
}
}
Oops, something went wrong.

0 comments on commit 2ec5217

Please sign in to comment.