Fix /paste on map max borders (Thanks joshim4)

This commit is contained in:
UnknownShadow200 2017-02-21 19:15:18 +11:00
parent 6af9ec951c
commit 8f7c709e4d
2 changed files with 12 additions and 12 deletions

View File

@ -40,7 +40,7 @@ namespace MCGalaxy.Drawing.Ops {
if (cState.Z != cState.OriginZ) m[0].Z -= (cState.Length - 1);
Min = m[0]; Max = m[0];
Max.X += cState.Width; Max.Y += cState.Height; Max.Z += cState.Length;
Max.X += cState.Width - 1; Max.Y += cState.Height - 1; Max.Z += cState.Length - 1;
}
public override void Perform(Vec3S32[] marks, Brush brush, Action<DrawOpBlock> output) {
@ -48,9 +48,9 @@ namespace MCGalaxy.Drawing.Ops {
bool pasteAir = state.PasteAir;
Vec3U16 p1 = Clamp(Min), p2 = Clamp(Max);
for (ushort y = p1.Y; y < p2.Y; y++)
for (ushort z = p1.Z; z < p2.Z; z++)
for (ushort x = p1.X; x < p2.X; x++)
for (ushort y = p1.Y; y <= p2.Y; y++)
for (ushort z = p1.Z; z <= p2.Z; z++)
for (ushort x = p1.X; x <= p2.X; x++)
{
DrawOpBlock block = Place(x, y, z, brush);
if (pasteAir || block.Block != Block.air) output(block);

View File

@ -103,17 +103,17 @@ namespace MCGalaxy.Generator {
for (int x = 0; x < width; ++x)
{
double noise = module.GetValue(x / 100.0, 0.1, z / 100.0);
int height2D = (int)System.Math.Floor((noise + 2) * 10) + (half - 20);
int height2Dtex01 = (int)System.Math.Floor((noise + 2) * 15) + (half - 30);
byte topBlock = height2D < height2Dtex01 ? Block.grass : Block.sand;
lvl.SetTile((ushort)x, (ushort)height2D, (ushort)z, topBlock);
int dirtHeight = (int)System.Math.Floor((noise + 2) * 10) + (half - 20);
int sandHeight = (int)System.Math.Floor((noise + 2) * 15) + (half - 30);
byte topBlock = dirtHeight < sandHeight ? Block.grass : Block.sand;
lvl.SetTile((ushort)x, (ushort)dirtHeight, (ushort)z, topBlock);
if (height2D < waterHeight) {
for (int y = waterHeight; y >= height2D; y--)
if (dirtHeight < waterHeight) {
for (int y = waterHeight; y >= dirtHeight; y--)
lvl.SetTile((ushort)x, (ushort)y, (ushort)z, Block.water);
}
for (int y = height2D - 1; y >= 0; y--) {
byte block = (y > height2D * 3 / 4) ? Block.dirt : Block.rock;
for (int y = dirtHeight - 1; y >= 0; y--) {
byte block = (y > dirtHeight * 3 / 4) ? Block.dirt : Block.rock;
lvl.SetTile((ushort)x, (ushort)y, (ushort)z, block);
}
}