本文整理汇总了C#中SMP.World.GetBlockContainer方法的典型用法代码示例。如果您正苦于以下问题:C# World.GetBlockContainer方法的具体用法?C# World.GetBlockContainer怎么用?C# World.GetBlockContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMP.World
的用法示例。
在下文中一共展示了World.GetBlockContainer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Windows
byte type; //This holds type information, used in deciding which kind of window we need to send.
#endregion Fields
#region Constructors
public Windows(WindowType type, Point3 pos, World world, Player p)
{
try
{
id = FreeId();
this.type = (byte)type;
this.p = p;
switch (Type)
{
case WindowType.Chest:
name = "Chest"; //We change this to "Large Chest" Later if it needs it :3
container = world.GetBlockContainer(pos);
items = container.Items;
container.AddPlayer(p);
break;
case WindowType.Dispenser:
name = "Workbench";
//container = world.GetBlockContainer(pos); // We don't have a container for this yet.
items = new Item[9];
break;
case WindowType.Furnace:
name = "Furnace";
//container = world.GetBlockContainer(pos); // We don't have a container for this yet.
items = new Item[3];
break;
case WindowType.Workbench:
name = "Dispenser";
items = new Item[10];
break;
case WindowType.EnchantmentTable:
name = "Enchant";
items = new Item[1];
break;
case WindowType.BrewingStand:
name = "Brewing Stand";
//container = world.GetBlockContainer(pos); // We don't have a container for this yet.
items = new Item[4];
break;
}
if (Type == WindowType.Workbench || Type == WindowType.EnchantmentTable)
{
for (int i = 0; i < InventorySize; i++)
items[i] = Item.Nothing;
}
}
catch { Logger.Log("Error making window!"); }
}
示例2: Update
public void Update(World w, Player p)
{
byte bType, bMeta;
ushort bExtra;
int xxx, zzz;
Container c;
for (int xx = 0; xx < Width; xx++)
for (int zz = 0; zz < Depth; zz++)
for (int yy = 0; yy < Height; yy++)
{
xxx = (x << 4) + xx; zzz = (z << 4) + zz;
bType = GetBlock(xx, yy, zz);
bMeta = GetMetaData(xx, yy, zz);
if (bType == (byte)Blocks.SignPost || bType == (byte)Blocks.SignWall)
p.SendUpdateSign(xxx, (short)yy, zzz, w.GetSign(xxx, yy, zzz));
if (bType == (byte)Blocks.Jukebox)
{
bExtra = GetExtraData(xx, yy, zz);
if (bExtra >= 2256 && bExtra <= 2266)
p.SendSoundEffect(xxx, (byte)yy, zzz, 1005, bExtra);
}
if (bType == (byte)Blocks.Chest)
{
p.SendBlockChange(xxx, (byte)yy, zzz, bType, bMeta);
c = w.GetBlockContainer(xxx, yy, zzz);
if (c != null) c.UpdateState();
}
}
}