本文整理汇总了C#中MCForge.Player.SendBlockchange方法的典型用法代码示例。如果您正苦于以下问题:C# Player.SendBlockchange方法的具体用法?C# Player.SendBlockchange怎么用?C# Player.SendBlockchange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Player
的用法示例。
在下文中一共展示了Player.SendBlockchange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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>();
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) != cpos.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);
}
示例2: 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.");
}
示例3: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
p.SendBlockchange(x, y, z, p.level.GetTile(x, y, z));
CatchPos bp = (CatchPos)p.blockchangeObject;
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
p.Blockchange += Blockchange2;
}
示例4: 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);
p.blockchangeObject = new CatchPos(x, y, z);
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例5: 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 = Server.useMySQL ? MySQL.fillData("SELECT * FROM `Block" + p.level.name + "` WHERE X=" + (int)x + " AND Y=" + (int)y + " AND Z=" + (int)z) : SQLite.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");
//Server.s.Log(Blocks.Rows[i]["Type"].ToString());
BlockUsed = Block.Name(Convert.ToByte(Blocks.Rows[i]["Type"])).ToString();
Deleted = Convert.ToBoolean(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();
}
示例6: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
byte block = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, block);
Position bp;
bp.x = x; bp.y = y; bp.z = z; bp.type = type; p.blockchangeObject = bp;
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例7: Blockchange2
public void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
p.SendBlockchange(x, y, z, p.level.GetTile(x, y, z));
CatchPos cpos = (CatchPos)p.blockchangeObject;
FileStream fs = File.OpenRead(@Server.backupLocation + "/" + p.level.name + "/" + cpos.backup + "/" + p.level.name + ".lvl");
GZipStream gs = new GZipStream(fs, CompressionMode.Decompress);
byte[] ver = new byte[2];
gs.Read(ver, 0, ver.Length);
ushort version = BitConverter.ToUInt16(ver, 0);
ushort[] vars = new ushort[6];
try
{
if (version == 1874)
{
byte[] header = new byte[16]; gs.Read(header, 0, header.Length);
vars[0] = BitConverter.ToUInt16(header, 0);
vars[1] = BitConverter.ToUInt16(header, 2);
vars[2] = BitConverter.ToUInt16(header, 4);
}
else
{
byte[] header = new byte[12]; gs.Read(header, 0, header.Length);
vars[0] = version;
vars[1] = BitConverter.ToUInt16(header, 0);
vars[2] = BitConverter.ToUInt16(header, 2);
}
byte[] blocks = new byte[vars[0] * vars[2] * vars[1]];
gs.Read(blocks, 0, blocks.Length);
gs.Dispose();
fs.Dispose();
if (blocks.Length != p.level.blocks.Length) { p.SendMessage("Cant restore selection of different size maps."); blocks = null; return; }
if (p.level.bufferblocks && !p.level.Instant)
{
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)
BlockQueue.Addblock(p, xx, yy, zz, blocks[xx + (zz * vars[0]) + (yy * vars[0] * vars[1])]);
}
else
{
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)
p.level.Blockchange(p, xx, yy, zz, blocks[xx + (zz * vars[0]) + (yy * vars[0] * vars[1])]);
}
blocks = null;
if (p.staticCommands) p.Blockchange += Blockchange1;
}
catch { Server.s.Log("Restore selection failed"); }
}
示例8: 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);
bp = (CatchPos)p.blockchangeObject;
thex = x; they = y + 2; thez = z; p.blockchangeObject = bp;
Thread t = new Thread(ZombieMob);
t.Start(p);
}
示例9: BlockchangeHCone
public void BlockchangeHCone(Player p, ushort x, ushort y, ushort z, byte type)
{
int height = p.BcVar[0];
int radius = p.BcVar[1];
byte b = p.level.GetTile(x, y, z);
p.SendBlockchange(x, y, z, b);
p.ClearBlockchange();
Util.SCOGenerator.HCone(p, x, y, z, height, radius, type);
}
示例10: 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);
}
示例11: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
p.SendBlockchange(x, y, z, p.level.GetTile(x, y, z));
CatchPos cpos = (CatchPos)p.blockchangeObject;
LavaSurvival.MapSettings settings = Server.lava.LoadMapSettings(p.level.name);
if (cpos.mode == 0) settings.blockFlood = new LavaSurvival.Pos(x, y, z);
if (cpos.mode == 1) settings.blockLayer = new LavaSurvival.Pos(x, y, z);
Server.lava.SaveMapSettings(settings);
Player.SendMessage(p, "Position set! &b(" + x + ", " + y + ", " + z + ")");
}
示例12: 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);
}
示例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;
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);
}
示例14: Blockchange1
public void Blockchange1(Player p, ushort x, ushort y, ushort z, byte type)
{
p.ClearBlockchange();
//com(p, "get the type of the changed block");
byte b = p.level.GetTile(x, y, z);
//com(p, "undo the change2");
p.SendBlockchange(x, y, z, b);
//com(p, "blockundone making Catchpos bp");
CatchPos bp = (CatchPos)p.blockchangeObject;
//com(p, "copy the coordinates");
p.copystart[0] = x;
p.copystart[1] = y;
p.copystart[2] = z;
//com(p, "saving the coordinates");
com(p, x + "," + y + "," + z);
bp.x = x; bp.y = y; bp.z = z; p.blockchangeObject = bp;
//com(p, "wait for next blockchange");
p.Blockchange += new Player.BlockchangeEventHandler(Blockchange2);
}
示例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;
ushort xx, yy, zz; int foundBlocks = 0;
for (xx = Math.Min(cpos.x, x); xx <= Math.Max(cpos.x, x); ++xx)
for (yy = Math.Min(cpos.y, y); yy <= Math.Max(cpos.y, y); ++yy)
for (zz = Math.Min(cpos.z, z); zz <= Math.Max(cpos.z, z); ++zz)
{
if (p.level.GetTile(xx, yy, zz) != cpos.toIgnore) foundBlocks++;
}
Player.SendMessage(p, foundBlocks + " blocks are between (" + cpos.x + ", " + cpos.y + ", " + cpos.z + ") and (" + x + ", " + y + ", " + z + ")");
if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
}