Search in sources :

Example 1 with Direction

use of org.pepsoft.minecraft.Direction in project WorldPainter by Captain-Chaos.

the class World2 method transform.

/**
 * Transforms all dimensions of this world horizontally. If an undo manager
 * is installed this operation will destroy all undo info.
 *
 * @param transform The coordinate transform to apply.
 * @param progressReceiver A progress receiver which will be informed of
 *     rotation progress.
 */
public void transform(CoordinateTransform transform, ProgressReceiver progressReceiver) throws ProgressReceiver.OperationCancelled {
    int dimCount = dimensions.size(), dim = 0;
    for (Dimension dimension : dimensions.values()) {
        dimension.transform(transform, (progressReceiver != null) ? new SubProgressReceiver(progressReceiver, (float) dim / dimCount, 1.0f / dimCount) : null);
        dim++;
    }
    Point oldSpawnPoint = spawnPoint;
    spawnPoint = transform.transform(spawnPoint);
    propertyChangeSupport.firePropertyChange("spawnPoint", oldSpawnPoint, spawnPoint);
    Direction oldUpIs = upIs;
    upIs = transform.inverseTransform(upIs);
    propertyChangeSupport.firePropertyChange("upIs", oldUpIs, upIs);
    dirty = true;
}
Also used : SubProgressReceiver(org.pepsoft.util.SubProgressReceiver) Direction(org.pepsoft.minecraft.Direction)

Example 2 with Direction

use of org.pepsoft.minecraft.Direction in project WorldPainter by Captain-Chaos.

the class World2 method setUpIs.

public void setUpIs(Direction upIs) {
    if (upIs != this.upIs) {
        Direction oldUpIs = this.upIs;
        this.upIs = upIs;
        dirty = true;
        propertyChangeSupport.firePropertyChange("upIs", oldUpIs, upIs);
    }
}
Also used : Direction(org.pepsoft.minecraft.Direction)

Example 3 with Direction

use of org.pepsoft.minecraft.Direction in project WorldPainter by Captain-Chaos.

the class World2 method transform.

/**
 * Transforms one dimension horizontally. If it's the surface dimension also
 * transforms any surface-related metadata stored in the world. If an undo
 * manager is installed this operation will destroy all undo info.
 *
 * @param dim The index of the dimension to transform.
 * @param transform The coordinate transform to apply.
 * @param progressReceiver A progress receiver which will be informed of
 *     rotation progress.
 */
public void transform(int dim, CoordinateTransform transform, ProgressReceiver progressReceiver) throws ProgressReceiver.OperationCancelled {
    dimensions.get(dim).transform(transform, progressReceiver);
    if (dim == DIM_NORMAL) {
        Point oldSpawnPoint = spawnPoint;
        spawnPoint = transform.transform(spawnPoint);
        propertyChangeSupport.firePropertyChange("spawnPoint", oldSpawnPoint, spawnPoint);
        Direction oldUpIs = upIs;
        upIs = transform.inverseTransform(upIs);
        propertyChangeSupport.firePropertyChange("upIs", oldUpIs, upIs);
    }
    dirty = true;
}
Also used : Direction(org.pepsoft.minecraft.Direction)

Aggregations

Direction (org.pepsoft.minecraft.Direction)3 SubProgressReceiver (org.pepsoft.util.SubProgressReceiver)1