Advanced Section Usage (recommended after learning the basics)
showIndependentSection
scene.world.showIndependentSection(selection: Selection, fadeInDirection: Direction): ElementLink<WorldSectionElement>Shows a section and returns an
ElementLinkpointing to that section (animation lasts 15 ticks).jsconst example_link = scene.world.showIndependentSection( [2, 1, 2], Direction.down );
showIndependentSection
scene.world.showIndependentSection(selection: Selection, fadeInDirection: Direction, fadeInDuration: number): ElementLink<WorldSectionElement>Compared with the method above, this one adds a
fadeInDurationparameter.This parameter is an integer used to change animation duration.
showIndependentSectionImmediately
scene.world.showIndependentSectionImmediately(selection: Selection): ElementLink<WorldSectionElement>A simplified version of the two methods above. It shows a section immediately and returns its
ElementLink.As a tradeoff, the default
fadeInDirectionisDirection.down.
showSectionAndMerge
scene.world.showSectionAndMerge(selection: Selection, fadeInDirection: Direction, link: ElementLink<WorldSectionElement>): voidRemember the
example_linkcreated above?That is exactly the
linkparameter accepted here.This method shows a section and merges it into the section referenced by
link(animation lasts 15 ticks).
glueBlockOnto
scene.world.glueBlockOnto(blockPos: BlockPos, fadeInDirection: Direction, link: ElementLink<WorldSectionElement>): voidThis method exists mainly for Java developer convenience.
In JavaScript, the only difference from the previous method is the first parameter:
This method only accepts one block position.
The method above supports either one block position or a region.
hideSection
scene.world.hideSection(selection: Selection, fadeOutDirection: Direction): voidHides the selected section.
Hide animation duration is 15 ticks.
hideIndependentSection
scene.world.hideIndependentSection(link: ElementLink<WorldSectionElement>, fadeOutDirection: Direction, fadeOutDuration: number): voidHides the section referenced by the provided
link.
hideIndependentSectionImmediately
scene.world.showIndependentSectionImmediately(link: ElementLink<WorldSectionElement>): voidImmediately hides the section referenced by
link.Default hide direction is
Direction.down.
rotateSection
scene.world.rotateSection(link: ElementLink<WorldSectionElement>, xRotation: number, yRotation: number, zRotation: number, duration: number)Accepts a
linkand rotates the section it references (for example, one merged viashowSectionAndMerge).The last four parameters are
double,double,double, andint.
makeSectionIndependent
scene.world.makeSectionIndependent(selection: Selection): ElementLink<WorldSectionElement>Splits the selected region out from
baseWorldSectionas an independent section.
moveSection
scene.world.moveSection(link: ElementLink<WorldSectionElement>, offset: Vec3, duration: number): voidMoves the section referenced by
link. The second parameter can be an array like[x, y, z].