The Brush
class is responsible for determining the output blocks from most draw operations
Some visual examples of brushes [TODO sample image]
Remarks
- See also the BrushFactory class that parses player input to create a
Brush
Returns the name of this brush
Performs additional configuration/calculations for the given draw operation
Remarks:
- Most brushes do not need to override this method
Examples:
ReplaceBrush
changesop.Flags
toBlockDBFlags.Replaced
(so that/b
shows 'Replaced' instead of 'Drawn')CloudyBrush
attempts to calculate appropriate noise thresholds based on the draw operation's boundaries
Returns the output block based on the draw operation's current state (usually this just means the current coordinates)
Remarks:
- If no block should be output, return
Block.Invalid
using MCGalaxy;
using MCGalaxy.Drawing.Brushes;
using MCGalaxy.Drawing.Ops;
using BlockID = System.UInt16;
public sealed class NeapolitanBrush : Brush
{
public override string Name { get { return "Neapolitan"; } }
public override BlockID NextBlock(DrawOp op) {
int width = op.Max.X - op.Min.X;
int oneThirdX = op.Min.X + width / 3;
int twoThirdX = op.Min.X + width * 2 / 3;
if (op.Coords.X <= oneThirdX) {
return Block.White;
} else if (op.Coords.X <= twoThirdX) {
return Block.Brown;
} else {
return Block.Pink;
}
}
}
[TODO output example image]