本文整理汇总了C#中MCSong.Player.SendBlockchange方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendBlockchange方法的具体用法?C# Player.SendBlockchange怎么用?C# Player.SendBlockchange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCSong.Player
的用法示例。
在下文中一共展示了Player.SendBlockchange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: highlightStuff
public void highlightStuff(string[] fileContent, Int64 seconds, Player p)
{
Player.UndoPos Pos;
for (int i = fileContent.Length / 7; i >= 0; i--)
{
try
{
if (Convert.ToDateTime(fileContent[(i * 7) + 4].Replace('&', ' ')).AddSeconds(seconds) >= DateTime.Now)
{
Level foundLevel = Level.Find(fileContent[i * 7]);
if (foundLevel != null && foundLevel == p.level)
{
Pos.mapName = foundLevel.name;
Pos.x = Convert.ToUInt16(fileContent[(i * 7) + 1]);
Pos.y = Convert.ToUInt16(fileContent[(i * 7) + 2]);
Pos.z = Convert.ToUInt16(fileContent[(i * 7) + 3]);
Pos.type = foundLevel.GetTile(Pos.x, Pos.y, Pos.z);
if (Pos.type == Convert.ToByte(fileContent[(i * 7) + 6]) || Block.Convert(Pos.type) == Block.water || Block.Convert(Pos.type) == Block.lava)
{
if (Pos.type == Block.air || Block.Convert(Pos.type) == Block.water || Block.Convert(Pos.type) == Block.lava)
p.SendBlockchange(Pos.x, Pos.y, Pos.z, Block.red);
else p.SendBlockchange(Pos.x, Pos.y, Pos.z, Block.green);
}
}
}
else break;
}
catch { }
}
}
示例2: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
unchecked { if (cpos.type != (byte)-1) { type = cpos.type; } }
List<Pos> buffer = new List<Pos>();
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
{
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
{
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
{
if (p.level.GetTile(xx, yy, zz) == type) { BufferAdd(buffer, xx, yy, zz); }
}
}
}
if (buffer.Count > p.group.maxBlocks)
{
Player.SendMessage(p, "You tried to replace " + buffer.Count + " blocks.");
Player.SendMessage(p, "You cannot replace more than " + p.group.maxBlocks + ".");
return;
}
Player.SendMessage(p, buffer.Count.ToString() + " blocks.");
buffer.ForEach(delegate(Pos pos)
{
p.level.Blockchange(p, pos.x, pos.y, pos.z, cpos.type2); //update block for everyone
});
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例3: ExitChange
public void ExitChange(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
portalPos bp = (portalPos)p.blockchangeObject;
foreach (portPos pos in bp.port)
{
DataTable Portals = MySQL.fillData("SELECT * FROM `Portals" + pos.portMapName + "` WHERE EntryX=" + (int)pos.x + " AND EntryY=" + (int)pos.y + " AND EntryZ=" + (int)pos.z);
Portals.Dispose();
if (Portals.Rows.Count == 0)
{
MySQL.executeQuery("INSERT INTO `Portals" + pos.portMapName + "` (EntryX, EntryY, EntryZ, ExitMap, ExitX, ExitY, ExitZ) VALUES (" + (int)pos.x + ", " + (int)pos.y + ", " + (int)pos.z + ", '" + p.level.name + "', " + (int)x + ", " + (int)y + ", " + (int)z + ")");
}
else
{
MySQL.executeQuery("UPDATE `Portals" + pos.portMapName + "` SET ExitMap='" + p.level.name + "', ExitX=" + (int)x + ", ExitY=" + (int)y + ", ExitZ=" + (int)z + " WHERE EntryX=" + (int)pos.x + " AND EntryY=" + (int)pos.y + " AND EntryZ=" + (int)pos.z);
}
//DB
if (pos.portMapName == p.level.name) p.SendBlockchange(pos.x, pos.y, pos.z, bp.type);
}
Player.SendMessage(p, "&3Exit" + Server.DefaultColor + " block placed");
if (p.staticCommands) { bp.port.Clear(); p.blockchangeObject = bp; p.Blockchange += new Player.BlockchangeEventHandler(EntryChange); }
}
示例4: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
CatchPos cpos = (CatchPos)p.blockchangeObject;
cpos.message = cpos.message.Replace("'", "\\'");
DataTable Messages = MySQL.fillData("SELECT * FROM `Messages" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
Messages.Dispose();
if (Messages.Rows.Count == 0)
{
MySQL.executeQuery("INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (" + (int)x + ", " + (int)y + ", " + (int)z + ", '" + cpos.message + "')");
}
else
{
MySQL.executeQuery("UPDATE `Messages" + p.level.name + "` SET Message='" + cpos.message + "' WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
}
Player.SendMessage(p, "Message block placed.");
p.level.Blockchange(p, x, y, z, cpos.type);
p.SendBlockchange(x, y, z, cpos.type);
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例5: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
Level.Zone Zn;
Zn.smallX = Math.Min(cpos.x, x);
Zn.smallY = Math.Min(cpos.y, y);
Zn.smallZ = Math.Min(cpos.z, z);
Zn.bigX = Math.Max(cpos.x, x);
Zn.bigY = Math.Max(cpos.y, y);
Zn.bigZ = Math.Max(cpos.z, z);
Zn.Owner = cpos.Owner;
p.level.ZoneList.Add(Zn);
//DB
MySQL.executeQuery("INSERT INTO `Zone" + p.level.name + "` (SmallX, SmallY, SmallZ, BigX, BigY, BigZ, Owner) VALUES (" + Zn.smallX + ", " + Zn.smallY + ", " + Zn.smallZ + ", " + Zn.bigX + ", " + Zn.bigY + ", " + Zn.bigZ + ", '" + Zn.Owner + "')");
//DB
Player.SendMessage(p, "Added zone for &b" + cpos.Owner);
}
示例6: EntryChange
public void EntryChange(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
portalPos bp = (portalPos)p.blockchangeObject;
if (bp.Multi && type == Block.red && bp.port.Count > 0) { ExitChange(p, x, y, z, type); return; }
byte b = p.level.GetTile(x, y, z);
p.level.Blockchange(p, x, y, z, bp.type);
p.SendBlockchange(x, y, z, Block.green);
portPos Port;
Port.portMapName = p.level.name;
Port.x = x; Port.y = y; Port.z = z;
bp.port.Add(Port);
p.blockchangeObject = bp;
if (!bp.Multi)
{
p.Blockchange += new Player.BlockchangeEventHandler(ExitChange);
Player.SendMessage(p, "&aEntry block placed");
}
else
{
p.Blockchange += new Player.BlockchangeEventHandler(EntryChange);
Player.SendMessage(p, "&aEntry block placed. &cRed block for exit");
}
}
示例7: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
if (!p.staticCommands) p.ClearBlockchange();
CatchPos cpos = (CatchPos)p.blockchangeObject;
byte oldType = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, oldType);
int diffX = 0, diffZ = 0;
if (p.rot[0] <= 32 || p.rot[0] >= 224) { diffZ = -1; }
else if (p.rot[0] <= 96) { diffX = 1; }
else if (p.rot[0] <= 160) { diffZ = 1; }
else diffX = -1;
List<Pos> buffer = new List<Pos>();
Pos pos;
int total = 0;
if (diffX != 0)
{
for (ushort xx = x; total < cpos.distance; xx += (ushort)diffX)
{
for (ushort yy = (ushort)(y - 1); yy <= (ushort)(y + 1); yy++)
for (ushort zz = (ushort)(z - 1); zz <= (ushort)(z + 1); zz++)
{
pos.x = xx; pos.y = yy; pos.z = zz;
buffer.Add(pos);
}
total++;
}
}
else
{
for (ushort zz = z; total < cpos.distance; zz += (ushort)diffZ)
{
for (ushort yy = (ushort)(y - 1); yy <= (ushort)(y + 1); yy++)
for (ushort xx = (ushort)(x - 1); xx <= (ushort)(x + 1); xx++)
{
pos.x = xx; pos.y = yy; pos.z = zz;
buffer.Add(pos);
}
total++;
}
}
if (buffer.Count > p.group.maxBlocks)
{
Player.SendMessage(p, "You tried to drill " + buffer.Count + " blocks.");
Player.SendMessage(p, "You cannot drill more than " + p.group.maxBlocks + ".");
return;
}
foreach (Pos pos1 in buffer)
{
if (p.level.GetTile(pos1.x, pos1.y, pos1.z) == oldType)
p.level.Blockchange(p, pos1.x, pos1.y, pos1.z, Block.air);
}
Player.SendMessage(p, buffer.Count + " blocks.");
}
示例8: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
List<CatchPos> buffer = new List<CatchPos>();
CatchPos pos = new CatchPos();
//int totalChecks = 0;
//if (Math.Abs(cpos.x - x) * Math.Abs(cpos.y - y) * Math.Abs(cpos.z - z) > 8000) { Player.SendMessage(p, "Tried to restart too many blocks. You may only restart 8000"); return; }
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
{
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
{
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
{
if (p.level.GetTile(xx, yy, zz) != Block.air)
{
pos.x = xx; pos.y = yy; pos.z = zz;
pos.extraInfo = cpos.extraInfo;
buffer.Add(pos);
}
}
}
}
try
{
if (cpos.extraInfo == "")
{
if (buffer.Count > Server.rpNormLimit)
{
Player.SendMessage(p, "Cannot restart more than " + Server.rpNormLimit + " blocks.");
Player.SendMessage(p, "Tried to restart " + buffer.Count + " blocks.");
return;
}
}
else
{
if (buffer.Count > Server.rpLimit)
{
Player.SendMessage(p, "Tried to add physics to " + buffer.Count + " blocks.");
Player.SendMessage(p, "Cannot add physics to more than " + Server.rpLimit + " blocks.");
return;
}
}
}
catch { return; }
foreach (CatchPos pos1 in buffer)
{
p.level.AddCheck(p.level.PosToInt(pos1.x, pos1.y, pos1.z), pos1.extraInfo, true);
}
Player.SendMessage(p, "Activated " + buffer.Count + " blocks.");
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例9: AboutBlockchange
public void AboutBlockchange(Player p, ushort x, ushort y, ushort z, byte type)
{
if (!p.staticCommands) p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
if (b == Block.Zero) { Player.SendMessage(p, "Invalid Block(" + x + "," + y + "," + z + ")!"); return; }
p.SendBlockchange(x, y, z, b);
string message = "Block (" + x + "," + y + "," + z + "): ";
message += "&f" + b + " = " + Block.Name(b);
Player.SendMessage(p, message + Server.DefaultColor + ".");
message = p.level.foundInfo(x, y, z);
if (message != "") Player.SendMessage(p, "Physics information: &a" + message);
DataTable Blocks = MySQL.fillData("SELECT * FROM `Block" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z);
string Username, TimePerformed, BlockUsed;
bool Deleted, foundOne = false;
for (int i = 0; i < Blocks.Rows.Count; i++)
{
foundOne = true;
Username = Blocks.Rows[i]["Username"].ToString();
TimePerformed = DateTime.Parse(Blocks.Rows[i]["TimePerformed"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
BlockUsed = Block.Name((byte)Blocks.Rows[i]["Type"]).ToString();
Deleted = (bool)Blocks.Rows[i]["Deleted"];
if (!Deleted)
Player.SendMessage(p, "&3Created by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
else
Player.SendMessage(p, "&4Destroyed by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
Player.SendMessage(p, "Date and time modified: &2" + TimePerformed);
}
List<Level.BlockPos> inCache = p.level.blockCache.FindAll(bP => bP.x == x && bP.y == y && bP.z == z);
for (int i = 0; i < inCache.Count; i++)
{
foundOne = true;
Deleted = inCache[i].deleted;
Username = inCache[i].name;
TimePerformed = inCache[i].TimePerformed.ToString("yyyy-MM-dd HH:mm:ss");
BlockUsed = Block.Name(inCache[i].type);
if (!Deleted)
Player.SendMessage(p, "&3Created by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
else
Player.SendMessage(p, "&4Destroyed by " + Server.FindColor(Username.Trim()) + Username.Trim() + Server.DefaultColor + ", using &3" + BlockUsed);
Player.SendMessage(p, "Date and time modified: &2" + TimePerformed);
}
if (!foundOne)
Player.SendMessage(p, "This block has not been modified since the map was cleared.");
Blocks.Dispose();
GC.Collect();
GC.WaitForPendingFinalizers();
}
示例10: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例11: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
try
{
p.ClearBlockchange();
CatchPos cpos = (CatchPos)p.blockchangeObject;
if (cpos.type == Block.Zero) cpos.type = p.bindings[type];
byte oldType = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, oldType);
if (cpos.type == oldType) { Player.SendMessage(p, "Cannot fill the same time"); return; }
if (!Block.canPlace(p, oldType) && !Block.BuildIn(oldType)) { Player.SendMessage(p, "Cannot fill that."); return; }
byte[] mapBlocks = new byte[p.level.blocks.Length];
List<Pos> buffer = new List<Pos>();
p.level.blocks.CopyTo(mapBlocks, 0);
fromWhere.Clear();
deep = 0;
FloodFill(p, x, y, z, cpos.type, oldType, cpos.FillType, ref mapBlocks, ref buffer);
int totalFill = fromWhere.Count;
for (int i = 0; i < totalFill; i++)
{
totalFill = fromWhere.Count;
Pos pos = fromWhere[i];
deep = 0;
FloodFill(p, pos.x, pos.y, pos.z, cpos.type, oldType, cpos.FillType, ref mapBlocks, ref buffer);
totalFill = fromWhere.Count;
}
fromWhere.Clear();
if (buffer.Count > p.group.maxBlocks)
{
Player.SendMessage(p, "You tried to fill " + buffer.Count + " blocks.");
Player.SendMessage(p, "You cannot fill more than " + p.group.maxBlocks + ".");
return;
}
foreach (Pos pos in buffer)
{
p.level.Blockchange(p, pos.x, pos.y, pos.z, cpos.type);
}
Player.SendMessage(p, "Filled " + buffer.Count + " blocks.");
buffer.Clear();
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
catch (Exception e)
{
Server.ErrorLog(e);
}
}
示例12: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
type = p.bindings[type];
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
ushort cur;
if (x == cpos.x && z == cpos.z) { Player.SendMessage(p, "No direction was selected"); return; }
if (Math.Abs(cpos.x - x) > Math.Abs(cpos.z - z))
{
cur = cpos.x;
if (x > cpos.x)
{
foreach (char c in cpos.givenMessage)
{
cur = FindReference.writeLetter(p, c, cur, cpos.y, cpos.z, type, 0);
}
}
else
{
foreach (char c in cpos.givenMessage)
{
cur = FindReference.writeLetter(p, c, cur, cpos.y, cpos.z, type, 1);
}
}
}
else
{
cur = cpos.z;
if (z > cpos.z)
{
foreach (char c in cpos.givenMessage)
{
cur = FindReference.writeLetter(p, c, cpos.x, cpos.y, cur, type, 2);
}
}
else
{
foreach (char c in cpos.givenMessage)
{
cur = FindReference.writeLetter(p, c, cpos.x, cpos.y, cur, type, 3);
}
}
}
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例13: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
p.CopyBuffer.Clear();
int TotalAir = 0;
if (cpos.type == 2) p.copyAir = true; else p.copyAir = false;
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
{
b = p.level.GetTile(xx, yy, zz);
if (Block.canPlace(p, b))
{
if (b == Block.air && cpos.type != 2 || cpos.ignoreTypes.Contains(b)) TotalAir++;
if (cpos.ignoreTypes.Contains(b)) BufferAdd(p, (ushort)(xx - cpos.x), (ushort)(yy - cpos.y), (ushort)(zz - cpos.z), Block.air);
else BufferAdd(p, (ushort)(xx - cpos.x), (ushort)(yy - cpos.y), (ushort)(zz - cpos.z), b);
}
else BufferAdd(p, (ushort)(xx - cpos.x), (ushort)(yy - cpos.y), (ushort)(zz - cpos.z), Block.air);
}
if ((p.CopyBuffer.Count - TotalAir) > p.group.maxBlocks)
{
Player.SendMessage(p, "You tried to copy " + p.CopyBuffer.Count + " blocks.");
Player.SendMessage(p, "You cannot copy more than " + p.group.maxBlocks + ".");
p.CopyBuffer.Clear();
return;
}
if (cpos.type == 1)
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
{
b = p.level.GetTile(xx, yy, zz);
if (b != Block.air && Block.canPlace(p, b))
p.level.Blockchange(p, xx, yy, zz, Block.air);
}
Player.SendMessage(p, (p.CopyBuffer.Count - TotalAir) + " blocks copied.");
if (allowoffset != -1)
{
Player.SendMessage(p, "Place a block to determine where to paste from");
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange3);
}
}
示例14: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
List<Pos> buffer = new List<Pos>();
Pos pos;
bool AddMe = false;
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
{
AddMe = true;
if (!Block.RightClick(Block.Convert(p.level.GetTile(xx, yy, zz)), true) && p.level.GetTile(xx, yy, zz) != cpos.countOther)
{
if (Block.RightClick(Block.Convert(p.level.GetTile((ushort)(xx - 1), yy, zz))) || p.level.GetTile((ushort)(xx - 1), yy, zz) == cpos.countOther) AddMe = false;
else if (Block.RightClick(Block.Convert(p.level.GetTile((ushort)(xx + 1), yy, zz))) || p.level.GetTile((ushort)(xx + 1), yy, zz) == cpos.countOther) AddMe = false;
else if (Block.RightClick(Block.Convert(p.level.GetTile(xx, (ushort)(yy - 1), zz))) || p.level.GetTile(xx, (ushort)(yy - 1), zz) == cpos.countOther) AddMe = false;
else if (Block.RightClick(Block.Convert(p.level.GetTile(xx, (ushort)(yy + 1), zz))) || p.level.GetTile(xx, (ushort)(yy + 1), zz) == cpos.countOther) AddMe = false;
else if (Block.RightClick(Block.Convert(p.level.GetTile(xx, yy, (ushort)(zz - 1)))) || p.level.GetTile(xx, yy, (ushort)(zz - 1)) == cpos.countOther) AddMe = false;
else if (Block.RightClick(Block.Convert(p.level.GetTile(xx, yy, (ushort)(zz + 1)))) || p.level.GetTile(xx, yy, (ushort)(zz + 1)) == cpos.countOther) AddMe = false;
}
else AddMe = false;
if (AddMe) { pos.x = xx; pos.y = yy; pos.z = zz; buffer.Add(pos); }
}
if (buffer.Count > p.group.maxBlocks)
{
Player.SendMessage(p, "You tried to hollow more than " + buffer.Count + " blocks.");
Player.SendMessage(p, "You cannot hollow more than " + p.group.maxBlocks + ".");
return;
}
buffer.ForEach(delegate(Pos pos1)
{
p.level.Blockchange(p, pos1.x, pos1.y, pos1.z, Block.air);
});
Player.SendMessage(p, "You hollowed " + buffer.Count + " blocks.");
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}
示例15: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
CatchPos cpos = (CatchPos)p.blockchangeObject;
unchecked { if (cpos.type != (byte)-1) { type = cpos.type; } }
List<Pos> buffer = new List<Pos>();
Pos pos;
bool AddMe = false;
for (ushort xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
for (ushort yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
for (ushort zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
{
AddMe = false;
if (p.level.GetTile((ushort)(xx - 1), yy, zz) == cpos.type) AddMe = true;
else if (p.level.GetTile((ushort)(xx + 1), yy, zz) == cpos.type) AddMe = true;
else if (p.level.GetTile(xx, (ushort)(yy - 1), zz) == cpos.type) AddMe = true;
else if (p.level.GetTile(xx, (ushort)(yy + 1), zz) == cpos.type) AddMe = true;
else if (p.level.GetTile(xx, yy, (ushort)(zz - 1)) == cpos.type) AddMe = true;
else if (p.level.GetTile(xx, yy, (ushort)(zz + 1)) == cpos.type) AddMe = true;
if (AddMe && p.level.GetTile(xx, yy, zz) != cpos.type) { pos.x = xx; pos.y = yy; pos.z = zz; buffer.Add(pos); }
}
if (buffer.Count > p.group.maxBlocks)
{
Player.SendMessage(p, "You tried to outline more than " + buffer.Count + " blocks.");
Player.SendMessage(p, "You cannot outline more than " + p.group.maxBlocks + ".");
return;
}
buffer.ForEach(delegate(Pos pos1)
{
p.level.Blockchange(p, pos1.x, pos1.y, pos1.z, cpos.type2);
});
Player.SendMessage(p, "You outlined " + buffer.Count + " blocks.");
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}