Minecraft Mods

Craftscript Diagonaliser v1.0.1 (Worldedit Craftscript)

  • 2,437 views, 7 today
  • 202 downloads, 0 today
  • 18
  • 11
  • 1
1Krista's Avatar 1Krista
Level 58 : Grandmaster Procrastinator
545
Description

Craftscript Diagonaliser is a Worldedit Craftscript that allows you to turn you straight build (aligned with the minecraft grid) to an angled build using just one command. This script is to be used similar to the Worldedit rotate command. It basically rotates your build around the Y axis. But the method used in this script is different from using the normal rotate command (using trig functions). Instead, this script used the method that I and some people refer to as "Grid Rotatation." This method split your selection into a grid of specified size, then shift those cells around to rotate the selection. It will however leave a 1x1 air gap in between the intersections, which has to be manually fixed.

How to install?

In the zip folder you will see a file called "Diag.js". This is the script file that you must place in to Worldedit's config folder. Follow the instruction below, or the instruction at https://worldedit.enginehub.org/en/latest/usage/other/craftscripts/

  1. Before you start, you will need to install Rhino Javascript engine. Link to the download is in Enginehub website above.
  2. Once you've downloaded the jar file, rename it to "js.jar" (very important)
  3. Place "js.jar" into ".minecraft/mods/" folder for single player or to "plugins/" folder for multiplayer server.
  4. If you haven't already, create a folder in "config/worldedit/" named "craftscripts"
  5. Place my script file "Diag.js" or any other script file in "config/worldedit/craftscripts/"
  6. You are good to go. Restart your client or server if it doesn't work the first time.


How to use?

To put it simply, you select the region that you want to diagonalise. Then, run my script. And boom, finished. Simple as that.

There are a couple restriction, though, when using this script. I am a noob programmer and this script is made using my high school Javascript knowledge. I didn't put any commands to limit the input. So, if you input something crazy, it will probably give an error message, or crash.

  1. This script should only work with a CUBOID SELECTION. Do not use any other selection type, I have not tested any of them.
  2. Try not to input any unaccepted values (see the next section). They may lead to a maths error.
  3. I don't know how efficient this script is. So, use it at your own risk and don't use in on a large selection.

With that aside, to execute the script, make a CUBOID SELECTION and enter the following command:

  /cs diag <x amount> <z amount> [​direction] [​x offset] [​z offset]

The script accepts a maximum of 5 arguments, 2 of which are required. Followings are the arguments and their description:

  <x amount> - Width of shifting grid (x axis). Can be any positive integer smaller than the selection region width.
  <z amount> - Length of shifting grid (z axis). Can be any positive integer smaller than the selection region length.
  [​direction] - Rotate direction. Enter 0 for clockwise and 1 for counter-clockwise (optional). Default value is 0.
  [​x offset] - Grid offset in x direction. Can be any positive integer.
  [​z offset] - Grid offset in z direction. Can be any positive integer.

<x amount> and <z amount> determine the size of the cell. Every cell will be identical except for the last cells along the +x and +z edge.The cell will start counting at the northwest corner of your selection. For example, <x amount> = 3 means it will count 3 blocks starting from the northwest corner before shifting z by one block. Then continues counting for another 3 blocks and shift z by another block, and so on.

[​direction] simply specifies the direction of rotation. 0 for clockwise, 1 for counter-clockwise. If you don't input this it will
assume you want to rotate clockwise. Pretty straightforward.

Now, if you don't want the selection to start counting from the northwest corner, you can use the <x offset> and <z offset> to change that. Note that it will still count from the northwest corner, but you can skip a certain amount of blocks before counting. For example, if <x amount> = 3 and <x offset> = 1, it will first count 1 then shift z by one block, then count 3 and shift z by another block, then count another 3 and so on.

Y value will not be affected by the script at all (Y won't be diagonalised) and you cannot change that (without modifying the code). If you want to diagonalise the Y axis, rotate your selection around X or Z axis with the regular rotate command first.

Air block won't be affected by the script. But it counts as a block when counting the grid (<x amount> and <z amount>).

I know this is complicated to understand, but I suggest you try this out in game for yourself. Once you get hang of the grid rotation method, it will be a lot easier to understand, trust me.

There's a known problem with blockstates at the moment (v1.0.1). The script will remember the blockstates but it will not be affected by //perf update off and //perf neighbors off This should be fixed in later versions.

Update Log
v1.0.1 - Fixed offset for counter-clockwise rotation
   - Updated grammar errors in README.txt




Resources

This is a free software licensed under the GNU General Public License v3.0. You are allowed to use, modify, and redistribute this program under this license.
Progress100% complete
Game VersionMinecraft 1.16.5
Tags

Create an account or sign in to comment.

2
07/16/2021 6:02 pm
Level 62 : High Grandmaster Engineer
Krysot
Krysot's Avatar
Nice, it works fine. It´s good for small things, but bigger one still needs to be diagonalised by basic world edit commands piecewise
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome