Skip to content

Commit

Permalink
Replace drawop.Max with SizeX/Y/Z
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Sep 13, 2022
1 parent d105f07 commit b74b6c0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
3 changes: 1 addition & 2 deletions MCGalaxy/Drawing/Brushes/CloudyBrush.cs
Expand Up @@ -82,8 +82,7 @@ public sealed class CloudyBrush : Brush
}

// Map noise distribution to block coverage
int volume = (op.Max.X - op.Min.X + 1)
* (op.Max.Y - op.Min.Y + 1) * (op.Max.Z - op.Min.Z + 1);
int volume = op.SizeX * op.SizeY * op.SizeZ;
float sum = 0;
for (int i = 0; i < accuracy; i++) {
// Update the thresholds
Expand Down
12 changes: 6 additions & 6 deletions MCGalaxy/Drawing/DrawOps/CuboidDrawOp.cs
Expand Up @@ -26,7 +26,7 @@ public class CuboidDrawOp : DrawOp
public override string Name { get { return "Cuboid"; } }

public override long BlocksAffected(Level lvl, Vec3S32[] marks) {
return (Max.X - Min.X + 1) * (Max.Y - Min.Y + 1) * (Max.Z - Min.Z + 1);
return SizeX * SizeY * SizeZ;
}

public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output) {
Expand All @@ -45,11 +45,11 @@ public class CuboidHollowsDrawOp : DrawOp
public override string Name { get { return "Cuboid Hollow"; } }

public override long BlocksAffected(Level lvl, Vec3S32[] marks) {
int lenX = (Max.X - Min.X + 1), lenY = (Max.Y - Min.Y + 1), lenZ = (Max.Z - Min.Z + 1);
int lenX = SizeX, lenY = SizeY, lenZ = SizeZ;
int xQuadsVol = Math.Min(lenX, 2) * (lenY * lenZ);
int yQuadsVol = Math.Max(0, Math.Min(lenY, 2) * ((lenX - 2) * lenZ)); // we need to avoid double counting overlaps
int zQuadzVol = Math.Max(0, Math.Min(lenZ, 2) * ((lenX - 2) * (lenY - 2)));
return xQuadsVol + yQuadsVol + zQuadzVol;
int zQuadsVol = Math.Max(0, Math.Min(lenZ, 2) * ((lenX - 2) * (lenY - 2)));
return xQuadsVol + yQuadsVol + zQuadsVol;
}

public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output) {
Expand Down Expand Up @@ -103,7 +103,7 @@ public class CuboidWallsDrawOp : CuboidHollowsDrawOp
public override string Name { get { return "Cuboid Walls"; } }

public override long BlocksAffected(Level lvl, Vec3S32[] marks) {
int lenX = (Max.X - Min.X + 1), lenY = (Max.Y - Min.Y + 1), lenZ = (Max.Z - Min.Z + 1);
int lenX = SizeX, lenY = SizeY, lenZ = SizeZ;
int xQuadsVol = Math.Min(lenX, 2) * (lenY * lenZ);
int zQuadsVol = Math.Max(0, Math.Min(lenZ, 2) * ((lenX - 2) * lenY)); // we need to avoid double counting overlaps
return xQuadsVol + zQuadsVol;
Expand All @@ -126,7 +126,7 @@ public class CuboidWireframeDrawOp : CuboidHollowsDrawOp
public override string Name { get { return "Cuboid Wireframe"; } }

public override long BlocksAffected(Level lvl, Vec3S32[] marks) {
int lenX = (Max.X - Min.X + 1), lenY = (Max.Y - Min.Y + 1), lenZ = (Max.Z - Min.Z + 1);
int lenX = SizeX, lenY = SizeY, lenZ = SizeZ;
int horSidesvol = 2 * (lenX * 2 + lenZ * 2); // TODO: slightly overestimated by at most four blocks.
int verSidesVol = Math.Max(0, lenY - 2) * 4;
return horSidesvol + verSidesVol;
Expand Down
4 changes: 2 additions & 2 deletions MCGalaxy/Drawing/DrawOps/ReplaceDrawOp.cs
Expand Up @@ -36,7 +36,7 @@ public class ReplaceDrawOp : DrawOp
public override string Name { get { return "Replace"; } }

public override long BlocksAffected(Level lvl, Vec3S32[] marks) {
return (Max.X - Min.X + 1) * (Max.Y - Min.Y + 1) * (Max.Z - Min.Z + 1);
return SizeX * SizeY * SizeZ;
}

public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output) {
Expand Down Expand Up @@ -64,7 +64,7 @@ public class ReplaceNotDrawOp : DrawOp
public override string Name { get { return "ReplaceNot"; } }

public override long BlocksAffected(Level lvl, Vec3S32[] marks) {
return (Max.X - Min.X + 1) * (Max.Y - Min.Y + 1) * (Max.Z - Min.Z + 1);
return SizeX * SizeY * SizeZ;
}

public override void Perform(Vec3S32[] marks, Brush brush, DrawOpOutput output) {
Expand Down
2 changes: 1 addition & 1 deletion MCGalaxy/Drawing/DrawOps/RestoreSelectionDrawOp.cs
Expand Up @@ -27,7 +27,7 @@ public class RestoreSelectionDrawOp : DrawOp
public override string Name { get { return "RestoreSelection"; } }

public override long BlocksAffected(Level lvl, Vec3S32[] marks) {
return (Max.X - Min.X + 1) * (Max.Y - Min.Y + 1) * (Max.Z - Min.Z + 1);
return SizeX * SizeY * SizeZ;
}

public RestoreSelectionDrawOp() {
Expand Down
2 changes: 1 addition & 1 deletion MCGalaxy/Server/Server.cs
Expand Up @@ -67,7 +67,7 @@ public sealed partial class Server
Logger.Log(LogType.SystemActivity, file + " doesn't exist, Downloading..");
try {
using (WebClient client = HttpUtil.CreateWebClient()) {
client.DownloadFile(Updater.BaseURL + file + "?raw=true", file);
client.DownloadFile(Updater.BaseURL + file, file);
}
if (File.Exists(file)) {
Logger.Log(LogType.SystemActivity, file + " download succesful!");
Expand Down
2 changes: 1 addition & 1 deletion MCGalaxy/util/OperatingSystem.cs
Expand Up @@ -37,7 +37,7 @@ public abstract class IOperatingSystem
/// (since current process image is replaced) </remarks>
public abstract void RestartProcess();
public abstract bool IsWindows { get; }
public virtual string StandaloneName { get { throw new NotImplementedException(); } }
public virtual string StandaloneName { get { return "UNSUPPORTED"; } }

public virtual void Init() { }

Expand Down

0 comments on commit b74b6c0

Please sign in to comment.