mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-10 06:48:34 +00:00
Small changes
This commit is contained in:
@ -170,7 +170,8 @@ public class HeightMap {
|
||||
int originZ = minY.getBlockZ();
|
||||
|
||||
int maxY = region.getMaximumPoint().getBlockY();
|
||||
BlockStateHolder fillerAir = BlockTypes.AIR.getDefaultState();
|
||||
|
||||
BlockState fillerAir = BlockTypes.AIR.getDefaultState();
|
||||
|
||||
int blocksChanged = 0;
|
||||
|
||||
@ -181,14 +182,19 @@ public class HeightMap {
|
||||
|
||||
// Apply heightmap
|
||||
for (int z = 0; z < height; ++z) {
|
||||
int zr = z + originZ;
|
||||
for (int x = 0; x < width; ++x) {
|
||||
int curHeight = this.data[index];
|
||||
if (this.invalid != null && this.invalid[index]) continue;
|
||||
|
||||
//Clamp newHeight within the selection area
|
||||
int newHeight = Math.min(maxY4, data[index++]);
|
||||
|
||||
int curBlock = (curHeight) >> 4;
|
||||
int newBlock = (newHeight + 15) >> 4;
|
||||
|
||||
// Offset x,z to be 'real' coordinates
|
||||
int xr = x + originX;
|
||||
int zr = z + originZ;
|
||||
|
||||
// Depending on growing or shrinking we need to start at the bottom or top
|
||||
if (newHeight > curHeight) {
|
||||
@ -239,6 +245,13 @@ public class HeightMap {
|
||||
return blocksChanged;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply a raw heightmap to the region
|
||||
*
|
||||
* @param data the data
|
||||
* @return number of blocks affected
|
||||
* @throws MaxChangedBlocksException
|
||||
*/
|
||||
public int apply(int[] data) throws MaxChangedBlocksException {
|
||||
checkNotNull(data);
|
||||
|
||||
@ -256,14 +269,17 @@ public class HeightMap {
|
||||
// Apply heightmap
|
||||
int index = 0;
|
||||
for (int z = 0; z < height; ++z) {
|
||||
int zr = z + originZ;
|
||||
for (int x = 0; x < width; ++x, index++) {
|
||||
int curHeight = this.data[index];
|
||||
if (this.invalid != null && this.invalid[index]) continue;
|
||||
|
||||
int curHeight = this.data[index];
|
||||
|
||||
// Clamp newHeight within the selection area
|
||||
int newHeight = Math.min(maxY, data[index]);
|
||||
|
||||
// Offset x,z to be 'real' coordinates
|
||||
int xr = x + originX;
|
||||
int zr = z + originZ;
|
||||
|
||||
// Depending on growing or shrinking we need to start at the bottom or top
|
||||
if (newHeight > curHeight) {
|
||||
@ -279,7 +295,7 @@ public class HeightMap {
|
||||
session.setBlock(xr, setY, zr, tmpBlock);
|
||||
++blocksChanged;
|
||||
}
|
||||
session.setBlock(xr, newHeight, zr, existing);
|
||||
session.setBlock(BlockVector3.at(xr, newHeight, zr), existing);
|
||||
++blocksChanged;
|
||||
}
|
||||
} else if (curHeight > newHeight) {
|
||||
|
@ -44,7 +44,7 @@ public class KochanekBartelsInterpolation implements Interpolation {
|
||||
private double scaling;
|
||||
|
||||
public KochanekBartelsInterpolation() {
|
||||
setNodes(Collections.emptyList());
|
||||
setNodes(Collections.<Node>emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -182,19 +182,19 @@ public class AffineTransform implements Transform, Serializable {
|
||||
public AffineTransform inverse() {
|
||||
if (inverse != null) return inverse;
|
||||
double det = this.determinant();
|
||||
return inverse = new AffineTransform(
|
||||
return new AffineTransform(
|
||||
(m11 * m22 - m21 * m12) / det,
|
||||
(m02 * m21 - m22 * m01) / det,
|
||||
(m21 * m02 - m01 * m22) / det,
|
||||
(m01 * m12 - m11 * m02) / det,
|
||||
(m01 * (m22 * m13 - m12 * m23) + m02 * (m11 * m23 - m21 * m13)
|
||||
- m03 * (m11 * m22 - m21 * m12)) / det,
|
||||
(m12 * m20 - m22 * m10) / det,
|
||||
(m20 * m12 - m10 * m22) / det,
|
||||
(m00 * m22 - m20 * m02) / det,
|
||||
(m02 * m10 - m12 * m00) / det,
|
||||
(m10 * m02 - m00 * m12) / det,
|
||||
(m00 * (m12 * m23 - m22 * m13) - m02 * (m10 * m23 - m20 * m13)
|
||||
+ m03 * (m10 * m22 - m20 * m12)) / det,
|
||||
(m10 * m21 - m20 * m11) / det,
|
||||
(m01 * m20 - m21 * m00) / det,
|
||||
(m20 * m01 - m00 * m21) / det,
|
||||
(m00 * m11 - m10 * m01) / det,
|
||||
(m00 * (m21 * m13 - m11 * m23) + m01 * (m10 * m23 - m20 * m13)
|
||||
- m03 * (m10 * m21 - m20 * m11)) / det);
|
||||
@ -348,9 +348,5 @@ public class AffineTransform implements Transform, Serializable {
|
||||
return String.format("Affine[%g %g %g %g, %g %g %g %g, %g %g %g %g]}", m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23);
|
||||
}
|
||||
|
||||
private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user