Facebook
From The_Dumbledodo, 2 Weeks ago, written in Java.
Embed
Download Paste or View Raw
Hits: 132
  1. final HashMap<Vector3i, List<EncodedBlock>> chunkBlocksHashMap = new HashMap<>();
  2.    final AffineTransform transform = new AffineTransform().rotateY(angle);
  3.  
  4.    final Region region = clipboard.getRegion();
  5.    final BlockVector3 clipboardOffset = region.getMinimumPoint().subtract(clipboard.getOrigin());
  6.  
  7.    final Iterator<BlockVector3> iterator = clipboard.getRegion().iterator();
  8.  
  9.    final Vector3 to = BukkitAdapter.asVector(location);
  10.    final Vector3 appliedVector = transform.apply(clipboardOffset.toVector3());
  11.  
  12.    final Vector3 realTo = to.add(appliedVector);
  13.    final Vector3 max = realTo.add(transform.apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3()));
  14.  
  15.    final CuboidRegionSelector selector = new CuboidRegionSelector(bukkitWorld, realTo.toBlockPoint(), max.toBlockPoint());
  16.    final CuboidRegion cuboidRegion = selector.getRegion();
  17.  
  18.    for (BlockVector3 blockVector3 : cuboidRegion) {
  19.  
  20.     final Vector3 vector3 = blockVector3.toVector3();
  21.  
  22.     // this is currently the problem (I'm transforming the clipboards location +
  23.     // the offset but I want to be able to get the blocks of the clipboard before pasting it)
  24.     final BaseBlock block = clipboard.getFullBlock(iterator.next());
  25.     if (block == null) continue;