Beispiel #1
0
        public PowerDevice Copy()
        {
            WorkItem    tmp  = ContainedWorkItem != null ? ContainedWorkItem : new WorkItem(new List <ItemStack>(), new List <ItemStack>(), 256, 256);
            PowerDevice copy = new PowerDevice(PowerType, tmp.Copy(), StoredPower, StorageCap, PowerDelta);

            return(copy);
        }
Beispiel #2
0
 public override void FromTreeAtributes(ITreeAttribute tree, IWorldAccessor worldAccessForResolve)
 {
     if (tree.GetString("powerdevice") != null)
     {
         device = JsonConvert.DeserializeObject <PowerDevice>(tree.GetString("powerdevice"));
     }
     base.FromTreeAtributes(tree, worldAccessForResolve);
 }
Beispiel #3
0
 public override void Initialize(ICoreAPI api)
 {
     base.Initialize(api);
     block = pos.GetBlock(api);
     if (device == null)
     {
         device = new PowerDevice(
             (EnumPowerType)block.Attributes["PowerType"].AsInt(), null,
             block.Attributes["PowerStored"].AsDouble(),
             block.Attributes["PowerCap"].AsDouble(256),
             block.Attributes["PowerDelta"].AsDouble());
     }
     Update();
     RegisterGameTickListener(OnGameTick, 30);
 }