本文整理汇总了C#中MCForge.Utils.Vector3S类的典型用法代码示例。如果您正苦于以下问题:C# Vector3S类的具体用法?C# Vector3S怎么用?C# Vector3S使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Vector3S类属于MCForge.Utils命名空间,在下文中一共展示了Vector3S类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ReadVector3SArray
static Vector3S[] ReadVector3SArray(this BinaryReader br) {
Vector3S[] ret = new Vector3S[br.ReadInt32()];
for (int i = 0; i < ret.Length; i++) {
ret[i] = br.ReadVector3S();
}
return ret;
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:7,代码来源:BinaryUtils.cs
示例2: CatchBlock2
public void CatchBlock2(Player sender, BlockChangeEventArgs args)
{
args.Unregister();
Vector3S FirstBlock = (Vector3S)sender.GetDatapass("CmdDatapassExample_FirstBlock");
Vector3S SecondBlock = new Vector3S(args.X, args.Z, args.Y);
sender.SendMessage("This is where we would initiate a Cuboid!");
}
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:7,代码来源:CmdDatapassExample.cs
示例3: BlockString
//TODO: fix if target is to close at origin
IEnumerable<Vector3S> BlockString(string text, Vector3S origin, Vector3S target, Vector3S lvlSize) {
Font font = new Font("Sans-serief",12);
Image tmp = new Bitmap(1000, 1000);
Bitmap img = new Bitmap((int)Graphics.FromImage(tmp).MeasureString(text, font).Width, (int)Graphics.FromImage(tmp).MeasureString(text, font).Height);
tmp = null;
Graphics g = Graphics.FromImage(img);
g.FillRectangle(Brushes.White, 0, 0, img.Width, img.Height);
g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixel;
g.DrawString(text, font, Brushes.Black, new PointF(0, 0));
List<Vector3S> path = new List<Vector3S>();
foreach (Vector3S p in origin.PathTo(target)) {
path.Add(p);
}
if (path.Count < 2) yield break;
for (int x = 0; x < img.Width; x++) {
for (int y = 0; y < img.Height; y++) {
if (img.GetPixel(x, y).ToArgb() != Color.White.ToArgb()) {
Vector3S ret = new Vector3S();
ret.x = (short)(origin.x + ((path[x % path.Count].x - origin.x) + (path[path.Count - 1].x - origin.x + path[1].x - origin.x) * (x / path.Count)));
ret.y = (short)(origin.y + ((path[x % path.Count].y - origin.y) + (path[path.Count - 1].y - origin.y + path[1].y - origin.y) * (x / path.Count)) + img.Height - y);
ret.z = (short)(origin.z + ((path[x % path.Count].z - origin.z) + (path[path.Count - 1].z - origin.z + path[1].z - origin.z) * (x / path.Count)));
if (ret.x < lvlSize.x && ret.y < lvlSize.y && ret.z < lvlSize.z && ret.x >= 0 && ret.y >= 0 && ret.z >= 0)
yield return ret;
}
}
}
}
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:29,代码来源:CmdWrite.cs
示例4: Use
public void Use(Entity.Player p, string[] args) {
if (args.Length == 1 && args[0] == "stop") {
p.OnPlayerRotate.Normal -= OnPlayerRotate_Normal;
p.OnPlayerMove.Normal -= OnPlayerMove_Normal;
p.OnPlayerBigMove.Normal -= OnPlayerBigMove_Normal;
p.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal;
if (p.ExtraData["Cursor"] != null) {
Vector3S old;
if (p.ExtraData["Cursor"].GetType() == typeof(Vector3S))
old = (Vector3S)p.ExtraData["Cursor"];
else {
old = new Vector3S();
old.FromString((string)p.ExtraData["Cursor"]);
}
p.SendBlockChange((ushort)old.x, (ushort)old.z, (ushort)old.y, p.Level.GetBlock(old));
p.ExtraData["Cursor"] = null;
}
if (p.ExtraData["CursorGlassCenter"] != null) {
Vector3S old;
if (p.ExtraData["CursorGlassCenter"].GetType() == typeof(Vector3S))
old = (Vector3S)p.ExtraData["CursorGlassCenter"];
else {
old = new Vector3S();
old.FromString((string)p.ExtraData["CursorGlassCenter"]);
}
p.ResendBlockChange(surrounder, old);
}
return;
}
p.OnPlayerRotate.Normal += OnPlayerRotate_Normal;
p.OnPlayerMove.Normal += OnPlayerMove_Normal;
p.OnPlayerBigMove.Normal += OnPlayerBigMove_Normal;
p.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal;
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:34,代码来源:CmdCursor.cs
示例5: ReadVector3S
static Vector3S ReadVector3S(this BinaryReader br) {
Vector3S ret = new Vector3S();
ret.x = br.ReadInt16();
ret.z = br.ReadInt16();
ret.y = br.ReadInt16();
return ret;
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:7,代码来源:BinaryUtils.cs
示例6: Vector3S
IEnumerable<Utils.Vector3S> IBrush.Draw(Vector3S pos, byte block, int size) {
Vector3S mVec = pos - (size / 2);
for (ushort x= 0; x < size; x++)
for (ushort y = 0; y < size; y++)
for (short z = 0; z < size; z++)
yield return new Vector3S((ushort)(x + mVec.x),(ushort) (z + mVec.z ) , (ushort)( y + mVec.y));
yield return pos;
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:8,代码来源:CubeBrush.cs
示例7: Level
private Level(Vector3S size)
{
Size = size;
//data = new byte[Size.x, Size.z, Size.y];
Data = new byte[TotalBlocks];
ExtraData = new Dictionary<object, object>();
}
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:8,代码来源:Level.cs
示例8: CatchBlock
public void CatchBlock(Player sender, BlockChangeEventArgs args)
{
args.Unregister();
Vector3S FirstBlock = new Vector3S(args.X, args.Z, args.Y);
sender.SendMessage("Please place another block...");
sender.SetDatapass("CmdDatapassExample_FirstBlock", FirstBlock);
sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2);
}
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:8,代码来源:CmdDatapassExample.cs
示例9: onlyAirBetween
bool onlyAirBetween(Vector3S start, Vector3S end)
{
Vector3D s = new Vector3D(start);
Vector3D e = new Vector3D(end);
while ((s - e).Length > 1) {
if (AirMap[(int)s.x, (int)s.z, (int)s.y] == TriBool.True) return false;
}
return true;
}
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:9,代码来源:BotMap.cs
示例10: PacketSpawnPlayer
/// <summary>
/// Initializes a new instance of the <see cref="PacketSpawnPlayer"/> class.
/// </summary>
public PacketSpawnPlayer(byte ID, string Name, Vector3S Location, byte Yaw, byte Pitch)
: base(PacketIDs.SpawnPlayer)
{
this.ID = ID;
this.Location = Location;
this.Yaw = Yaw;
this.Pitch = Pitch;
this.Name = Name;
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:12,代码来源:PacketSpawnPlayer.cs
示例11: Add
/// <summary>
/// Returns false if the message was only updated
/// </summary>
/// <param name="l"></param>
/// <param name="v"></param>
/// <param name="message"></param>
/// <returns></returns>
public bool Add(Level l, Vector3S v, string message)
{
bool ret = false;
if (!store[l.Name].Contains(v)) {
store[l.Name].Add(v);
ret = true;
}
l.ExtraData["MessageBlock" + v] = message;
return ret;
}
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:17,代码来源:PluginMessageBlock.cs
示例12: Use
public void Use(Player p, string[] args)
{
if (args.Count() != 0)
{
Help(p);
return;
}
Vector3S meep = new Vector3S((short)(p.Level.SpawnPos.x * 32), (short)(p.Level.SpawnPos.z * 32 + 51), (short)(p.Level.SpawnPos.y * 32));
p.SendToPos(meep, p.Level.SpawnRot);
}
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:10,代码来源:CmdSpawn.cs
示例13: Use
public void Use(Player p, string[] args)
{
if (args.Count() != 0)
{
Help(p);
return;
}
Vector3S meep = new Vector3S((short)(p.Pos.x / 32), (short)(p.Pos.z / 32), (short)(p.Pos.y / 32));
p.Level.SpawnPos = meep;
p.Level.SpawnRot = p.Rot;
p.SendMessage("Spawn location changed.");
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:12,代码来源:CmdSetSpawn.cs
示例14: ReadPacket
public override void ReadPacket(byte[] data) {
Position = new Vector3S(){
x = ReadShort(data, 0),
y = ReadShort(data, 2),
z = ReadShort(data, 4)
};
BlockDeleted = data[5] == 0x00;
Block = data[6];
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:12,代码来源:PacketPlayerSetBlock.cs
示例15: BC2
public void BC2(Player p, BlockChangeEventArgs args)
{
Vector3S _s = new Vector3S();
p.ExtraData["Mark2"] = new Vector3S(args.X, args.Z, args.Y);
p.SendMessage("Second coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")");
args.Unregister();
args.Cancel();
Vector3S m1 = (Vector3S)p.ExtraData["Mark1"];
Vector3S m2 = (Vector3S)p.ExtraData["Mark2"];
p.SendMessage("Marked coordinates:");
p.SendMessage("(" + m1.x + ", " + m1.z + ", " + m1.y + "), (" + m2.x + ", " + m2.z + ", " + m2.y + ")");
p.ExtraData["HasMarked"] = true;
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:13,代码来源:CmdSelect.cs
示例16: GetOwner
public static string GetOwner(Vector3S e, string level) {
using (var data = Database.fillData("SELECT * FROM Blocks WHERE X = '" + e.x + "' AND Y = '" + e.y + "' AND Z = '" + e.z + "' AND Level = '" + level.SqlEscape() + "';")) {
if (data.Rows.Count == 0) {
return null;
}
using (var playerData = Database.fillData("SELECT * FROM _players WHERE UID = " + data.Rows[0]["UID"].ToString().SqlEscape())) {
if (playerData.Rows.Count == 0) return null;
return playerData.Rows[0]["Name"].ToString();
}
}
}
开发者ID:nullpic,项目名称:MCForge-Vanilla,代码行数:13,代码来源:Helper.cs
示例17: DrawOnLevel
/// <summary>
/// Draws the on level.
/// </summary>
/// <param name="mLevel">The level to draw on.</param>
/// <param name="startPos">The start pos.</param>
/// <param name="blockOverlay">A block to set the component as. If it is not already set</param>
/// <remarks>if the block in the component is set to 255 a block overlay will be used automaticly, no block change will occur if the block is at 254</remarks>
public void DrawOnLevel(Level mLevel, Vector3S startPos, Direction dir, byte blockOverlay = 1) {
for (int i = 0; i < components.Length; i++) {
var comp = components[i];
if (comp.Block == 254)
continue;
switch (dir) {
case Direction.East:
mLevel.SetBlock(comp.Pos + startPos, comp.Block == 255 ? blockOverlay : comp.Block);
break;
case Direction.West:
mLevel.SetBlock(comp.Pos - startPos, comp.Block == 255 ? blockOverlay : comp.Block);
break;
}
}
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:22,代码来源:WorldComponents.cs
示例18: Bot
/// <summary>
/// A robot (entity) that appears in the world.
/// </summary>
public Bot(string Username, Vector3S Position, byte[] Rotation, Level level, bool FollowPlayers, bool BreakBlocks, bool Jumping)
{
Player = new Player();
Player.IsBot = true;
Player.Username = Username;
Player.Pos = Position;
Player.oldPos = new Vector3S(Position.x, Position.z, Position.y);
Player.Rot = Rotation;
Player.Level = level;
Player.id = FreeId();
Server.Bots.Add(this);
SpawnThisBotToOtherPlayers(this);
this.FollowPlayers = FollowPlayers;
this.BreakBlocks = BreakBlocks;
this.Jumping = Jumping;
}
开发者ID:Maicke98,项目名称:MCForge-Vanilla,代码行数:19,代码来源:Bot.cs
示例19: Use
public void Use(Player p, string[] args)
{
if (args.Count() != 0)
{
Help(p);
return;
}
Vector3S meep = new Vector3S((short)(16 + p.Level.CWMap.SpawnPos.x * 32), (short)(16 + p.Level.CWMap.SpawnPos.z * 32), (short)(p.Level.CWMap.SpawnPos.y * 32));
Packet pa = new Packet();
pa.Add(Packet.Types.SendTeleport);
pa.Add((byte)0xff);
pa.Add(meep.x);
pa.Add(meep.y);
pa.Add(meep.z);
pa.Add(new byte[2] { (byte)p.Level.CWMap.SpawnRotation.x, (byte)p.Level.CWMap.SpawnRotation.z });
p.SendPacket(pa);
}
开发者ID:headdetect,项目名称:MCForge6-Vanilla,代码行数:17,代码来源:CmdSpawn.cs
示例20: Use
public void Use(Player p, string[] args)
{
if (args.Count() != 0)
{
Help(p);
return;
}
Vector3S meep = new Vector3S((short)(p.Level.SpawnPos.x * 32), (short)(p.Level.SpawnPos.z * 32 + 51), (short)(p.Level.SpawnPos.y * 32));
Packet pa = new Packet();
pa.Add(Packet.Types.SendTeleport);
pa.Add(unchecked((byte)-1)); //If the ID is not greater than one it doesn't work :c
pa.Add(meep.x);
pa.Add(meep.y);
pa.Add(meep.z);
pa.Add(p.Rot);
p.SendPacket(pa);
}
开发者ID:ninedrafted,项目名称:MCForge-Vanilla,代码行数:18,代码来源:CmdSpawn.cs
注:本文中的MCForge.Utils.Vector3S类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论