本文整理汇总了C#中MCForge.Entity.Player.Click方法的典型用法代码示例。如果您正苦于以下问题:C# Player.Click方法的具体用法?C# Player.Click怎么用?C# Player.Click使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCForge.Entity.Player
的用法示例。
在下文中一共展示了Player.Click方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public void Use(Player p, string[] args) {
//if (p == null) stuff here, not sure if should add yet or not since Console cannot do commands at the moment.
Vector3S click = p.LastClick;
if (args.Length == 3) {
try {
for (int value = 0; value < 3; value++) {
switch (args[value].ToLower()) {
case "x":
case "z":
case "y":
break;
default:
if (isValid(args[value], value, p)) {
switch (value) {
case 0:
click.x = short.Parse(args[0]);
break;
case 1:
click.z = short.Parse(args[1]);
break;
case 2:
click.y = short.Parse(args[2]);
break;
}
}
else {
p.SendMessage("\"" + args[value] + "\" was not valid");
return;
}
break;
}
}
}
catch (Exception e) {
Logger.LogError(e);
return;
}
}
else {
p.SendMessage("Invalid arguments");
return;
}
p.Click((ushort)click.x, (ushort)click.z, (ushort)click.y, Block.BlockList.STONE);
p.SendMessage("Click &b(" + click.x + ", " + click.z + ", " + click.y + ").");
}
示例2: OnPlayerBlockChange_Normal
void OnPlayerBlockChange_Normal(Player sender, BlockChangeEventArgs args) {
args.Cancel();
if (args.Current == 0 && args.Action == ActionType.Delete) args.Current = 20;
sender.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal;
if (sender.ExtraData["Cursor"] != null) {
Vector3S cursor;
if (sender.ExtraData["Cursor"].GetType() == typeof(Vector3S))
cursor = (Vector3S)sender.ExtraData["Cursor"];
else {
cursor = new Vector3S();
cursor.FromString((string)sender.ExtraData["Cursor"]);
}
if (args.Action == ActionType.Place) {
sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y + 1), args.Holding);
}
else {
sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y), args.Holding, false);
}
}
sender.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal;
Curse(sender);
}