TheGreenGamerHD Im trying to teach myself some new things But the reason why im doing this is im rewriting my schematic plugin and i looked at world edit's code and they use vectors and block vectors and i dont understand why.
Vectors in WorldEdit refer to a location in the world. The different types of Vectors are for different purposes. For example, Vector.java is just for a general location in the world, and BlockVector.java is for a block's location in the world.
this that is the couboid region class, why do they use vectors? so why dont they use locations? what are the benefits of using vectors over locations? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
It's more customized to the developer's liking. For example, WorldEdit's main Vector class has more methods than Bukkit's Location class, which are used to save the developer time. In my opinion, I think there's not a case of more benefits rather than what the developer prefers, but I could be wrong.
There is one (and afaik ONLY ONE) fundamental difference between a BlockVector and a Location. a Location includes a World. a BlockVector does not.
I'll just leave this here Code:java @EventHandler(priority = EventPriority.NORMAL) public void onBlockExplode(EntityExplodeEvent e) { if (e.isCancelled()) return; if (e.blockList().isEmpty()) return; e.setYield(0.0F); double x = 0.0D; double y = 0.0D; double z = 0.0D; Location eLoc = e.getLocation(); World w = eLoc.getWorld(); for (int i = 0; i < e.blockList().size(); i++) { Block b = (Block) e.blockList().get(i); Location bLoc = b.getLocation(); if (!this.disallowedBlocks.contains(b.getType())) { x = bLoc.getX() - eLoc.getX(); y = bLoc.getY() - eLoc.getY() + 0.5D; z = bLoc.getZ() - eLoc.getZ(); FallingBlock fb = w.spawnFallingBlock(bLoc, b.getType(), b.getData()); fb.setDropItem(false); fb.setVelocity(new Vector(x, y, z)); } } }