mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-14 09:45:11 -04:00
Replace and paste brushes now support block ranges for arguments, also change striped brush to default to 'skip' instead of 'air' when only 0 or 1 argument provided
This commit is contained in:
parent
a9adbbd45f
commit
b4ff844f23
@ -16,6 +16,7 @@
|
||||
permissions and limitations under the Licenses.
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MCGalaxy.Commands;
|
||||
using BlockID = System.UInt16;
|
||||
|
||||
@ -52,14 +53,14 @@ namespace MCGalaxy.Drawing.Brushes
|
||||
}
|
||||
|
||||
internal static BlockID[] GetBlocks(Player p, int start, int max, string[] parts) {
|
||||
BlockID[] blocks = new BlockID[max - start];
|
||||
List<BlockID> blocks = new List<BlockID>(max - start);
|
||||
|
||||
for (int i = 0; start < max; start++, i++)
|
||||
{
|
||||
BlockID block;
|
||||
if (!CommandParser.GetBlockIfAllowed(p, parts[start], "draw with", out block)) return null;
|
||||
blocks[i] = block;
|
||||
int count = CommandParser.GetBlocksIfAllowed(p, parts[start], "draw with", blocks, false);
|
||||
if (count == 0) return null;
|
||||
}
|
||||
return blocks;
|
||||
return blocks.ToArray();
|
||||
}
|
||||
|
||||
static bool GetTargetBlock(BrushArgs args, string[] parts, out BlockID target) {
|
||||
|
@ -166,14 +166,14 @@ namespace MCGalaxy.Drawing.Brushes
|
||||
Player p = args.Player;
|
||||
if (args.Message.Length == 0) {
|
||||
if (!CommandParser.IsBlockAllowed(p, "draw with", args.Block)) return null;
|
||||
return new StripedBrush(args.Block, Block.Air);
|
||||
return new StripedBrush(args.Block, Block.Invalid);
|
||||
}
|
||||
string[] parts = args.Message.SplitSpaces();
|
||||
|
||||
BlockID block1;
|
||||
if (!CommandParser.GetBlockIfAllowed(p, parts[0], "draw with", out block1, true)) return null;
|
||||
if (parts.Length == 1)
|
||||
return new StripedBrush(block1, Block.Air);
|
||||
return new StripedBrush(block1, Block.Invalid);
|
||||
|
||||
BlockID block2;
|
||||
if (!CommandParser.GetBlockIfAllowed(p, parts[1], "draw with", out block2, true)) return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user