Empeld
Empeld plugin documentation.
essentials.Prefabs.Interop.MCSchematic Class Reference

Public Member Functions

 MCSchematic (MCBlockMap blockMap)
 
Prefab Load (Stream stream)
 

Constructor & Destructor Documentation

◆ MCSchematic()

essentials.Prefabs.Interop.MCSchematic.MCSchematic ( MCBlockMap  blockMap)
14  {
15  _blockMap = blockMap;
16  }

Member Function Documentation

◆ Load()

Prefab essentials.Prefabs.Interop.MCSchematic.Load ( Stream  stream)

Attribute: ] blocks = root.Get<byte[

>("Blocks");

Attribute: x,y,z] = _blockMap[blocks[(z*length+y)*width+x]

;

19  {
20  var data = NBTData.Load(stream);
21  var root = data.Get<NBTData>("Schematic");
22 
23  short width = root.Get<short>("Width");
24  short length = root.Get<short>("Length");
25  short height = root.Get<short>("Height");
26 
27  var prefab = new Prefab(width, length, height);
28 
29  byte[] blocks = root.Get<byte[]>("Blocks");
30  for (int x=0; x<width; ++x)
31  {
32  for (int y=0; y<length; ++y)
33  {
34  for (int z=0; z<height; ++z)
35  {
36  prefab[x,y,z] = _blockMap[blocks[(z*length+y)*width+x]];
37  }
38  }
39  }
40 
41  //Look at misses
42  var logger = Game.Services.GetDependency<IPluginLogger>();
43  foreach(var miss in _blockMap.MapMisses)
44  {
45  logger.LogWarn("Converter missed blockId {0}", miss);
46  }
47 
48  return prefab;
49  }
Definition: IPluginLogger.cs:6
IEnumerable< byte > MapMisses
Definition: MCBlockMap.cs:40
void LogWarn(string msg, params object[] args)

The documentation for this class was generated from the following file: