示例#1
0
 public void InitializeEnergyPoint(ICoreAPI api)
 {
     if (api.World.Side == EnumAppSide.Server)
     {
         foreach (BlockFacing face in BlockFacing.ALLFACES)
         {
             BlockPos pos = Pos.AddCopy(face);
             BlockEntityEnergyDuct block = api.World.BlockAccessor.GetBlockEntity(pos) as BlockEntityEnergyDuct;
             if (block != null)
             {
                 if (core == null)
                 {
                     if (block.core == null)
                     {
                         core = new EnergyDuctCore(MyMiniLib.GetAttributeInt(Block, "transfer", 500));
                         core.ducts.Add(this);
                     }
                     else
                     {
                         core = block.core;
                         core.ducts.Add(this);
                     }
                 }
                 else
                 {
                     if (core != block.core && block.core != null)
                     {
                         core = core.CombineCores(block.core);
                     }
                 }
             }
         }
         if (core == null)
         {
             core = new EnergyDuctCore(MyMiniLib.GetAttributeInt(Block, "transfer", 500));
             core.ducts.Add(this);
         }
     }
 }
示例#2
0
 public void InitializeEnergyPoint(ICoreAPI api)
 {
     if (api.World.Side == EnumAppSide.Server)
     {
         foreach (var kv in wiresList)
         {
             BlockEntityConnector block = api.World.BlockAccessor.GetBlockEntity(kv.Key) as BlockEntityConnector;
             if (block != null)
             {
                 if (core == null)
                 {
                     if (block.core == null)
                     {
                         core = new EnergyDuctCore(MyMiniLib.GetAttributeInt(Block, "transfer", 500));
                         core.ducts.Add(this);
                     }
                     else
                     {
                         core = block.core;
                         core.ducts.Add(this);
                     }
                 }
                 else
                 {
                     if (core != block.core && block.core != null)
                     {
                         core = core.CombineCores(block.core);
                     }
                 }
             }
         }
         if (core == null)
         {
             core = new EnergyDuctCore(MyMiniLib.GetAttributeInt(Block, "transfer", 500));
             core.ducts.Add(this);
         }
     }
 }